-
Notifications
You must be signed in to change notification settings - Fork 9
57 lines (52 loc) · 2.02 KB
/
deploy-core-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
name: Deploy core infrastructure
on:
push:
branches:
- main
paths:
- core/bicep/**
workflow_dispatch:
env:
RESOURCE_GROUP: ${{ vars.RESOURCE_GROUP }}
DNS_ZONE: ${{ vars.DNS_ZONE }}
AZURE_REGION: ${{ vars.AZURE_REGION }}
BICEP_FILE_PATH: core/bicep
BICEP_FILE_NAME: main
permissions:
id-token: write
contents: read
jobs:
core-infra-deployment:
environment: ${{ vars.DEFAULT_ENVIRONMENT }}
runs-on: ubuntu-latest
name: Build and Deploy core 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
uses: azure/CLI@v1
with:
inlineScript: |
az config set defaults.location=${{ env.AZURE_REGION }} defaults.group=${{ env.RESOURCE_GROUP }}
- name: Validate core infra bicep file ${{ env.BICEP_FILE_PATH }}/${{ env.BICEP_FILE_NAME }}.bicep
uses: azure/CLI@v1
with:
inlineScript: |
az deployment sub validate --template-file ./${{ env.BICEP_FILE_PATH }}/${{ env.BICEP_FILE_NAME }}.bicep -p resourceGroup=${{ env.RESOURCE_GROUP }} location=${{ env.AZURE_REGION }} dnsZoneName=${{ env.DNS_ZONE }}
az bicep upgrade
az bicep build --file ./${{ env.BICEP_FILE_PATH }}/${{ env.BICEP_FILE_NAME }}.bicep
- name: Deploy core infrastructure
id: coreInfraDeployment
uses: azure/arm-deploy@v1
with:
deploymentName: 'via-github-core-infra-${{ github.run_number }}'
scope: subscription
region: ${{ env.AZURE_REGION }}
template: ./${{ env.BICEP_FILE_PATH }}/${{ env.BICEP_FILE_NAME }}.json # Set this to the location of your template file
parameters: resourceGroup=${{ env.RESOURCE_GROUP }} location=${{ env.AZURE_REGION }} dnsZoneName=${{ env.DNS_ZONE }}