Repository navigation
202 lines (161 loc) · 6.18 KB
/
Copy pathazure-release.yml
File metadata and controls
202 lines (161 loc) · 6.18 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: Azure Release
on:
workflow_dispatch: {}
push:
branches:
- main
paths:
- BHS.slnx
- src/**
- tests/**
- yarn.lock
permissions: {}
concurrency:
group: azure-release
cancel-in-progress: false
env:
WEB_SRC_PATH: src/BHS.Web
WEB_PUBLISH_PATH: artifacts/publish/BHS.Web/release
CLIENTAPP_PATH: ./src/bhs-web-angular-app
DOTNET_BUILD_CONFIGURATION: Release
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Run actions/checkout with fetch-depth 0
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
- name: Setup GitVersion
uses: gittools/actions/gitversion/setup@51d325634925d7d9ce0a7efc2c586c0bc2b9eee6 # v3.2.1
with:
versionSpec: '5.x'
- run: corepack enable
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: .nvmrc
- name: Run gitversion
id: gitversion
uses: gittools/actions/gitversion/execute@51d325634925d7d9ce0a7efc2c586c0bc2b9eee6 # v3.2.1
with:
useConfigFile: true
- name: Add gitversion to summary
run: |
{
echo "### GitVersion"
echo ""
echo "- SEMANTIC_VERSION: ${STEPS_GITVERSION_OUTPUTS_FULLSEMVER}"
echo "- INFORMATIONAL_VERSION: ${STEPS_GITVERSION_OUTPUTS_INFORMATIONALVERSION}"
echo "- COMMIT_DATE: ${STEPS_GITVERSION_OUTPUTS_COMMITDATE}"
} >> "$GITHUB_STEP_SUMMARY"
env:
STEPS_GITVERSION_OUTPUTS_FULLSEMVER: ${{ steps.gitversion.outputs.fullSemVer }}
STEPS_GITVERSION_OUTPUTS_INFORMATIONALVERSION: ${{ steps.gitversion.outputs.informationalVersion }}
STEPS_GITVERSION_OUTPUTS_COMMITDATE: ${{ steps.gitversion.outputs.commitDate }}
- name: Run dotnet restore
run: dotnet restore
- name: Run dotnet build
run: dotnet build --no-restore --configuration ${{ env.DOTNET_BUILD_CONFIGURATION }} -p:Version="${STEPS_GITVERSION_OUTPUTS_FULLSEMVER}" -p:InformationalVersion="${STEPS_GITVERSION_OUTPUTS_INFORMATIONALVERSION}"
env:
STEPS_GITVERSION_OUTPUTS_FULLSEMVER: ${{ steps.gitversion.outputs.fullSemVer }}
STEPS_GITVERSION_OUTPUTS_INFORMATIONALVERSION: ${{ steps.gitversion.outputs.informationalVersion }}
- name: Run dotnet test
run: dotnet test --no-build --configuration ${{ env.DOTNET_BUILD_CONFIGURATION }} --verbosity normal
- run: yarn workspaces focus bhs-generated-models
- run: yarn models:build
- run: yarn workspaces focus bhs-web-angular-app
working-directory: ${{ env.CLIENTAPP_PATH }}
- run: yarn lint
working-directory: ${{ env.CLIENTAPP_PATH }}
- run: yarn transform-release
working-directory: ${{ env.CLIENTAPP_PATH }}
env:
SEMANTIC_VERSION: ${{ steps.gitversion.outputs.fullSemVer }}
INFORMATIONAL_VERSION: ${{ steps.gitversion.outputs.informationalVersion }}
COMMIT_DATE: ${{ steps.gitversion.outputs.commitDate }}
- run: yarn test-ci
working-directory: ${{ env.CLIENTAPP_PATH }}
- name: Run dotnet publish (runs Angular build as part of publish)
run: dotnet publish "${{ env.WEB_SRC_PATH }}" --configuration ${{ env.DOTNET_BUILD_CONFIGURATION }} --no-build
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: webapp
path: ${{ env.WEB_PUBLISH_PATH }}
retention-days: 5
deploy-stage:
if: github.repository_owner == 'JasonWeinzierl'
runs-on: ubuntu-latest
needs: build
environment:
name: staging
url: https://staging.beltonhistoricalsociety.org/
env:
AZURE_WEBAPP_NAME: staging-beltonhistorical
steps:
- name: Download Artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: webapp
path: ${{ env.WEB_PUBLISH_PATH }}
- name: Azure Login
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@02a81bead70021f5284939794bcec79c271ab383 # v3.0.8
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: ${{ env.WEB_PUBLISH_PATH }}
e2e-test-stage:
needs: deploy-stage
permissions:
contents: read
uses: ./.github/workflows/e2e.yml
with:
environment: staging
bail: true
secrets:
CYPRESS_AUTH0_TEST_PASSWORD: ${{ secrets.CYPRESS_AUTH0_TEST_PASSWORD }}
deploy-prod:
if: github.repository_owner == 'JasonWeinzierl'
runs-on: ubuntu-latest
needs:
- build
- e2e-test-stage
environment:
name: production
url: https://beltonhistoricalsociety.org/
env:
AZURE_WEBAPP_NAME: beltonhistorical
steps:
- name: Download Artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: webapp
path: ${{ env.WEB_PUBLISH_PATH }}
- name: Azure Login
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
- name: Deploy to Azure WebApp
uses: azure/webapps-deploy@02a81bead70021f5284939794bcec79c271ab383 # v3.0.8
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: ${{ env.WEB_PUBLISH_PATH }}
e2e-test-prod:
needs: deploy-prod
permissions:
contents: read
uses: ./.github/workflows/e2e.yml
with:
environment: production
bail: true
secrets:
CYPRESS_AUTH0_TEST_PASSWORD: ${{ secrets.CYPRESS_AUTH0_TEST_PASSWORD }}