-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (141 loc) · 4.99 KB
/
pipeline.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
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
on:
push:
branches:
- 'develop'
- 'main'
- 'feature/*'
workflow_dispatch:
env:
CSharpServerUrlIndex: 1
fileServerUrl: https://int-bmm-files.brunstad.org/
serverUrlIndex: 1
Api.BaseUrl: https://int-bmm-api.brunstad.org
jobs:
build_javascript:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v2
- name: cache .npm folder
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
- name: cache client node_modules
uses: actions/cache@v2
env:
cache-name: cache-client-node-modules
with:
path: ${{ github.workspace }}/client/node_modules
key: ${{ runner.os }}-client-node-modules-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-client-node-modules-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: cache admin node_modules
uses: actions/cache@v2
env:
cache-name: cache-admin-node-modules
with:
path: ${{ github.workspace }}/admin/node_modules
key: ${{ runner.os }}-admin-node-modules-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-admin-node-modules-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: common - npm install & updateCommonFiles
run: |
npm install
npm run updateCommonFiles
working-directory: ./common
- name: admin - build
run: |
npm install
npm run bowerUpdate
npm run build
working-directory: ./admin
- name: client - build
run: |
npm install
npm run bowerUpdate
npm run build
working-directory: ./client
- run: zip '${{ github.workspace }}/client.zip' -r ./
working-directory: ./client/dist
- run: zip '${{ github.workspace }}/admin.zip' -r ./
working-directory: ./admin/dist
- uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/**.zip
name: dist
if: (${{ job.status }} != 'cancelled')
build_dotnet:
runs-on: windows-latest
needs:
- build_javascript
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- name: dotnet build Release
run: dotnet build --configuration Release
- name: dotnet publish
run: dotnet publish --property PublishDir='${{ github.workspace }}/output/'
- name: unzip client files
run: unzip -o '${{ github.workspace }}/dist/client.zip' -d '${{ github.workspace }}/output/wwwroot'
- name: unzip admin files
run: unzip -o '${{ github.workspace }}/dist/admin.zip' -d '${{ github.workspace }}/output/wwwroot/admin'
- uses: actions/upload-artifact@v3
with:
path: ${{ github.workspace }}/output/
name: WebApp
deploy_int:
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
runs-on: windows-latest
environment: INT
needs:
- build_dotnet
steps:
- uses: actions/download-artifact@v2
- uses: microsoft/variable-substitution@v1
with:
files: '/WebApp/*.json, /WebApp/wwwroot/scripts/*.config.json, /WebApp/wwwroot/admin/scripts/*.config.json'
env:
CSharpServerUrlIndex: 1
- name: Deploy Client App Service
uses: Azure/webapps-deploy@v2
with:
app-name: INT-BMM
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ github.workspace }}/WebApp
deploy_prod:
runs-on: windows-latest
environment: PROD
needs:
- deploy_int
env:
CSharpServerUrlIndex: 0
fileServerUrl: https://bmm-files.brunstad.org/
serverUrlIndex: 0
Api.BaseUrl: https://bmm-api.brunstad.org
steps:
- uses: actions/download-artifact@v2
- uses: microsoft/variable-substitution@v1
with:
files: '/WebApp/*.json, /WebApp/wwwroot/scripts/*.config.json, /WebApp/wwwroot/admin/scripts/*.config.json'
- name: Deploy App Service in West Europe
uses: Azure/webapps-deploy@v2
with:
app-name: Prod-BMM
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ github.workspace }}/WebApp
slot-name: "staging"
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "currently-deployed-to-production"
prerelease: false
title: "Production Build"
files: |
WebApp/*