-
Notifications
You must be signed in to change notification settings - Fork 8
58 lines (47 loc) · 1.35 KB
/
main-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
58
name: Main - Infra - Build and deploy
on:
push:
branches:
- main
paths:
- ".github/workflows/main-infra.yml"
- "infra/**"
workflow_dispatch:
concurrency:
group: main-infra
defaults:
run:
shell: pwsh
permissions:
id-token: write
contents: read
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Load .env file
uses: xom9ikk/dotenv@v2
with:
path: ./.github
load-mode: strict
- name: Build
run: |
az bicep build --file ${{ env.BICEP_PATH }}
- name: Azure CLI - 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: Deploy
run: |
$timestamp = (Get-Date -Format yyyy-MM-ddTHH-mm)
az group create `
--location ${{ env.AZURE_RESOURCE_GROUP_LOCATION }} `
--name ${{ env.AZURE_RESOURCE_GROUP }}
az deployment group create `
--name $timestamp `
--resource-group ${{ env.AZURE_RESOURCE_GROUP }} `
--template-file ${{ env.BICEP_PATH }} `
--parameters "servicePrincipalObjectId=${{ secrets.AZURE_SERVICE_PRINCIPAL_OBJECT_ID }}"