-
Notifications
You must be signed in to change notification settings - Fork 124
90 lines (74 loc) · 2.99 KB
/
scheduled-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
# This file is part of our engineering process to build and maintain this file.
# See the README markdown file for further details
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
schedule:
- cron: '0 12 1 * *' # Run at 12:00 on the 1st day of the month
# https://learn.microsoft.com/en-us/azure/developer/github/connect-from-azure?tabs=azure-portal%2Clinux#set-up-azure-login-with-openid-connect-authentication
permissions:
id-token: write
contents: read
concurrency: integration_testing
jobs:
build:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/azure-dev-cli-apps:1.5.1
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
steps:
- name: Install jq tool
uses: dcarbone/install-jq-action@v2
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install Az module
run: Install-Module -Name Az -Force -AllowClobber -Scope CurrentUser -Repository PSGallery
shell: pwsh
- name: Check configuration
if: ${{ env.AZURE_CLIENT_ID == '' }}
run: echo "AZURE_CLIENT_ID are not available."
# login to run ado commands such provision, deploy, and down
- name: Log in with Azure (Federated Credentials)
if: ${{ env.AZURE_CLIENT_ID != '' }}
run: |
azd auth login `
--client-id "$Env:AZURE_CLIENT_ID" `
--federated-credential-provider "github" `
--tenant-id "$Env:AZURE_TENANT_ID" `
shell: pwsh
# login to run azd hooks and the QA validation script
- name: Log in with Azure CLI
if: ${{ env.AZURE_CLIENT_ID != '' }}
uses: Azure/login@v1.6.1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
enable-AzPSSession: true
- name: Set the environment
if: ${{ env.AZURE_CLIENT_ID != '' }}
run : azd env new ${{ secrets.AZURE_ENV_NAME }}
- name: Set the subscription
if: ${{ env.AZURE_CLIENT_ID != '' }}
run : azd env set AZURE_SUBSCRIPTION_ID ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Set the location
if: ${{ env.AZURE_CLIENT_ID != '' }}
run : azd env set AZURE_LOCATION ${{ secrets.AZURE_LOCATION }}
- name: Set the principal type
if: ${{ env.AZURE_CLIENT_ID != '' }}
run : azd env set AZURE_PRINCIPAL_TYPE ServicePrincipal
- name: Azure Deploy
if: ${{ env.AZURE_CLIENT_ID != '' }}
run : azd up
- name: QA - Validate Deployment
if: ${{ env.AZURE_CLIENT_ID != '' }}
run : ./testscripts/call-validate-deployment.sh
- name: Teardown Azure resources
if: ${{ env.AZURE_CLIENT_ID != '' }}
run : azd down --force --purge --no-prompt