Skip to content

Commit

Permalink
docs: add workflow examples (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
ljtill authored Sep 30, 2024
1 parent 0cc5d1a commit 5ce6c93
Show file tree
Hide file tree
Showing 3 changed files with 235 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Deployment
scope: subscription
subscription-id: 00000000-0000-0000-0000-000000000000
template-file: ./main.bicep
parameters: ./main.bicepparam
parameters-file: ./main.bicepparam
```
Deployment Stack
Expand All @@ -53,10 +53,13 @@ Deployment Stack
subscription-id: 00000000-0000-0000-0000-000000000000
template-file: ./main.bicep
parameters-file: ./main.bicepparam
action-on-unmanage: deleteAll
action-on-unmanage-resources: delete
action-on-unmanage-resourcegroups: delete
deny-settings-mode: denyWriteAndDelete
```
For end-to-end workflow examples, please see [Deployment](./examples/DEPLOYMENT.md) & [Deployment Stacks](./examples/STACKS.md).
## Dependencies
- [Login](https://github.com/azure/login): This action is used to authenticate
Expand Down
99 changes: 99 additions & 0 deletions examples/DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Deployment

**Create & Update**

```yaml
name: Deployment (Create)

on:
push:
branches:
- main

permissions:
contents: read
id-token: write

jobs:
deployment:
name: "Deployment"
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Create
uses: azure/deploy@v1
with:
operation: deployment
type: create
name: Development
location: westus2
scope: subscription
subscription-id: 00000000-0000-0000-0000-000000000000
template-file: ./main.bicep
parameters-file: ./main.bicepparameters.json
```
**Validate & What-If**
```yaml
name: Deployment (Validate)

on:
pull_request:
branches:
- main

permissions:
contents: read
id-token: write

jobs:
deployment:
name: "Validate"
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Validate
uses: azure/deploy@v1
with:
operation: deployment
type: validate
name: Development
location: westus2
scope: subscription
subscription-id: 00000000-0000-0000-0000-000000000000
template-file: ./main.bicep
parameters-file: ./main.bicepparam

- name: What-If
uses: azure/deploy@v1
with:
operation: deployment
type: whatIf
name: Development
location: westus2
scope: subscription
subscription-id: 00000000-0000-0000-0000-000000000000
template-file: ./main.bicep
parameters-file: ./main.bicepparam
```
131 changes: 131 additions & 0 deletions examples/STACKS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Deployment Stacks

**Create**

```yaml
name: Stacks (Create)

on:
push:
branches:
- main

permissions:
contents: read
id-token: write

jobs:
deployment:
name: "Stacks"
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Create
uses: azure/deploy@v1
with:
operation: deploymentStack
type: create
name: Development
location: westus2
scope: subscription
subscription-id: 00000000-0000-0000-0000-000000000000
template-file: ./main.bicep
parameters-file: ./main.bicepparameters.json
action-on-unmanage-resources: delete
action-on-unmanage-resourcegroups: delete
deny-settings-mode: denyWriteAndDelete
description: "Development Environment"
```
**Validate**
```yaml
name: Stacks (Validate)

on:
pull_request:
branches:
- main

permissions:
contents: read
id-token: write

jobs:
deployment:
name: "Stacks"
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Validate
uses: azure/deploy@v1
with:
operation: deploymentStack
type: validate
name: Development
location: westus2
scope: subscription
subscription-id: 00000000-0000-0000-0000-000000000000
template-file: ./main.bicep
parameters-file: ./main.bicepparameters.json
```
**Delete**
```yaml
name: Stacks (Delete)

on: workflow_dispatch

permissions:
contents: read
id-token: write

jobs:
deployment:
name: "Stacks"
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Delete
uses: azure/deploy@v1
with:
operation: deploymentStack
type: delete
name: Development
location: westus2
scope: subscription
subscription-id: 00000000-0000-0000-0000-000000000000
template-file: ./main.bicep
parameters-file: ./main.bicepparameters.json
```

0 comments on commit 5ce6c93

Please sign in to comment.