-
Notifications
You must be signed in to change notification settings - Fork 31
106 lines (99 loc) · 3.83 KB
/
azure-dev.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
95
96
97
98
99
100
101
102
103
104
105
106
# This workflow will deploy WordPress on Azure Container Apps
name: WordPress Deployment
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# The lint job performs linting on the bicep code
lint:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs the Bicep linter to ensure build is successful
- name: Run Bicep linter
run: az bicep build --file ./infra/main.bicep
validate:
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
name: Sign in to Azure
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/[email protected]
name: Run preflight validation
with:
deploymentName: ${{ github.run_number }}
scope: subscription
region: ${{ vars.AZURE_LOCATION }}
template: ./infra/main.bicep
parameters: environmentName=${{ vars.AZURE_ENV_NAME }}
location=${{ vars.AZURE_LOCATION }}
fqdn=${{ vars.AZURE_FQDN }}
applicationName=${{ vars.AZURE_APPLICATION_NAME }}
mariaDBPassword=${{ secrets.AZURE_MARIADB_PASSWORD }}
adminUsername=${{ vars.AZURE_ADMIN_USERNAME }}
adminPassword=${{ secrets.AZURE_ADMIN_PASSWORD }}
redisDeploymentOption=${{ vars.AZURE_REDIS_DEPLOYMENTOPTIONS }}
deploymentMode: Validate
preview:
runs-on: ubuntu-latest
needs: [lint, validate]
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
name: Sign in to Azure
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: Azure/cli@v1
name: Run what-if
with:
azcliversion: 2.45.0
inlineScript: |
az deployment sub what-if \
--location ${{ vars.AZURE_LOCATION }} \
--template-file ./infra/main.bicep \
--parameters environmentName=${{ vars.AZURE_ENV_NAME }} \
--parameters location=${{ vars.AZURE_LOCATION }} \
--parameters fqdn=${{ vars.AZURE_FQDN }} \
--parameters applicationName=${{ vars.AZURE_APPLICATION_NAME }} \
--parameters mariaDBPassword=${{ secrets.AZURE_MARIADB_PASSWORD }} \
--parameters adminUsername=${{ vars.AZURE_ADMIN_USERNAME }} \
--parameters adminPassword=${{ secrets.AZURE_ADMIN_PASSWORD }} \
--parameters redisDeploymentOption=${{ vars.AZURE_REDIS_DEPLOYMENTOPTIONS }}
deploy:
runs-on: ubuntu-latest
needs: [preview]
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
name: Sign in to Azure
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/[email protected]
id: deployment
name: Deployment
with:
deploymentName: "GitHubAction-${{ github.run_number }}"
scope: subscription
region: ${{ vars.AZURE_LOCATION }}
template: ./infra//main.bicep
parameters: environmentName=${{ vars.AZURE_ENV_NAME }}
location=${{ vars.AZURE_LOCATION }}
fqdn=${{ vars.AZURE_FQDN }}
applicationName=${{ vars.AZURE_APPLICATION_NAME }}
mariaDBPassword=${{ secrets.AZURE_MARIADB_PASSWORD }}
adminUsername=${{ vars.AZURE_ADMIN_USERNAME }}
adminPassword=${{ secrets.AZURE_ADMIN_PASSWORD }}
redisDeploymentOption=${{ vars.AZURE_REDIS_DEPLOYMENTOPTIONS }}
failOnStdErr: false