-
Notifications
You must be signed in to change notification settings - Fork 9
57 lines (53 loc) · 2.01 KB
/
deploy-frontend-infra.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
name: Deploy frontend infrastructure
on:
push:
branches:
- main
paths:
- frontend/bicep/**
workflow_dispatch:
env:
RESOURCE_GROUP: ${{ vars.RESOURCE_GROUP }}
DNS_ZONE: ${{ vars.DNS_ZONE }}
AZURE_REGION: ${{ vars.AZURE_REGION }}
BICEP_FILE_PATH: frontend/bicep
BICEP_FILE_NAME: main
permissions:
id-token: write
contents: read
jobs:
frontend-infra-deployment:
environment: ${{ vars.DEFAULT_ENVIRONMENT }}
runs-on: ubuntu-latest
name: Build and Deploy frontend infrastructure bicep templates
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Azure 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: Set default region and resource group for cli and register CDN
uses: azure/CLI@v1
with:
inlineScript: |
az config set defaults.location=${{ env.AZURE_REGION }} defaults.group=${{ env.RESOURCE_GROUP }}
az provider register --namespace Microsoft.Cdn
- name: Validate frontend infra bicep file ${{ env.BICEP_FILE_PATH }}/${{ env.BICEP_FILE_NAME }}.bicep
uses: azure/CLI@v1
with:
inlineScript: |
az deployment group validate --template-file ./${{ env.BICEP_FILE_PATH }}/${{ env.BICEP_FILE_NAME }}.bicep -p dnsZoneName=${{ env.DNS_ZONE }}
az bicep upgrade
az bicep build --file ./${{ env.BICEP_FILE_PATH }}/${{ env.BICEP_FILE_NAME }}.bicep
- name: Deploy frontend infrastructure
id: frontendInfraDeployment
uses: azure/arm-deploy@v1
with:
deploymentName: 'via-github-frontend-infra-${{ github.run_number }}'
resourceGroupName: ${{ env.RESOURCE_GROUP }}
region: ${{ env.AZURE_REGION }}
template: ./${{ env.BICEP_FILE_PATH }}/${{ env.BICEP_FILE_NAME }}.json # Set this to the location of your template file
parameters: dnsZoneName=${{ env.DNS_ZONE }}