-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (83 loc) · 3.06 KB
/
DeployBasicACA.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Deploy Azure Container Apps (frontend + backend)
#on: [push]
on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to verify'
type: environment
required: true
permissions:
id-token: write
contents: read
jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint code
run: |
az bicep build --file ./azure-container-app/main.bicep
Validate:
runs-on: ubuntu-latest
needs: lint
environment: ${{ github.event.inputs.environment }}
steps:
- uses: actions/checkout@v2
- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Run preflight validation'
uses: azure/arm-deploy@v1
with:
scope: subscription
region: norwayeast
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
deploymentName: ${{ github.run_number }}
template: ./azure-container-app/main.bicep
parameters: ./azure-container-app/configurations/azuredeploy.${{ github.event.inputs.environment }}.parameters.json env=${{ github.event.inputs.environment }}
deploymentMode: Validate
What-if:
runs-on: ubuntu-latest
needs: lint
environment: ${{ github.event.inputs.environment }}
steps:
- uses: actions/checkout@v2
- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Run what-if'
uses: azure/cli@v1
with:
inlineScript: |
az deployment sub what-if --location norwayeast \
--name ${{ github.run_number }} \
--template-file ./azure-container-app/main.bicep \
--parameters ./azure-container-app/configurations/azuredeploy.${{ github.event.inputs.environment }}.parameters.json env=${{ github.event.inputs.environment }}
Deploy:
runs-on: ubuntu-latest
needs: validate
environment: ${{ github.event.inputs.environment }}
steps:
- uses: actions/checkout@v2
- name: 'Az CLI login'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Deploy Azure Container App'
uses: azure/cli@v1
with:
inlineScript: |
az deployment sub create --location norwayeast \
--name ${{ github.run_number }} \
--template-file ./azure-container-app/main.bicep \
--parameters ./azure-container-app/configurations/azuredeploy.${{ github.event.inputs.environment }}.parameters.json env=${{ github.event.inputs.environment }}