-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (100 loc) · 2.92 KB
/
build.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET 8.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Restore dependencies
working-directory: SSW.Rules.AzFuncs/
run: dotnet restore
- name: Build
working-directory: SSW.Rules.AzFuncs/
run: dotnet build --no-restore
- name: Deploy
working-directory: SSW.Rules.AzFuncs/
run: |
dotnet publish \
--configuration Release \
--output ../deploy
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: functionsapp
path: deploy
validate-resources:
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v2
- name: Setup .NET 8.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- name: Generate ARM Template
working-directory: Azure/
run: dotnet run
env:
AUTH0_AUDIENCE: ${{ secrets.AUTH0_AUDIENCE }}
AUTH0_ISSUER: ${{ secrets.AUTH0_ISSUER }}
AZURE_RG_PREFIX: ${{ secrets.AZURE_RG_PREFIX }}
GITHUB_TOKEN: ${{ secrets.AZ_FUNC_GITHUB_PAT}}
CMS_OAUTH_CLIENT_ID: ${{ secrets.CMS_OAUTH_CLIENT_ID }}
CMS_OAUTH_CLIENT_SECRET: ${{ secrets.CMS_OAUTH_CLIENT_SECRET }}
- name: Login with Azure CLI
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Run ARM deploy
uses: azure/arm-deploy@v1
with:
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }}
resourceGroupName: ${{ secrets.AZURE_RG }}
template: Azure/arm-template.json
deploymentMode: Validate
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: arm-template
path: Azure/arm-template.json
deploy:
needs: [build, validate-resources]
if: ${{ github.ref == 'refs/heads/main' }}
environment: staging
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: arm-template
- name: Login with Azure CLI
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Run ARM deploy
uses: azure/arm-deploy@v1
with:
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }}
resourceGroupName: ${{ secrets.AZURE_RG }}
template: arm-template.json
- name: Setup .NET 8.0.x
uses: actions/setup-dotnet@v1
with:
dotnet-version: 8.0.x
- uses: actions/download-artifact@v2
with:
name: functionsapp
path: deploy
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ secrets.AZURE_RG_PREFIX }}-functions
package: deploy