-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (59 loc) · 2.52 KB
/
dotnet-cd-prod.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
name: prod-deploy
on:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
environment: AZ-Prod
steps:
- uses: actions/checkout@v4
- name: dependency caching
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: configure production front-end environment
run: |
set-content "rubberduckvba.client\src\environments\environment.prod.ts" -value "export const environment = { production: true, apiBaseUrl: '${{ vars.API_ROOT_URL }}' };"
set-content "rubberduckvba.client\src\environments\environment.ts" -value "export const environment = { production: true, apiBaseUrl: '${{ vars.API_ROOT_URL }}' };"
- name: dotnet build
run: dotnet build rubberduckvba.Server --configuration Release
- name: dotnet publish
run: dotnet publish "rubberduckvba.Server\rubberduckvba.Server.csproj" --configuration Release --output ${{env.DOTNET_ROOT}}\pub
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
name: pub
path: ${{env.DOTNET_ROOT}}\pub
deploy:
if: github.ref == 'refs/heads/main'
runs-on: self-hosted
needs: build
steps:
- name: prepare staging
run: remove-item C:/pub/webroot/rubberduckvba.com -Recurse -Force
- name: download artifacts
uses: actions/[email protected]
with:
name: pub
path: C:/pub/pub-prod.zip
- name: staging
run: move-item C:/pub/pub-prod.zip C:/pub/webroot/rubberduckvba.com -force
- name: deploy iis site
run: |
stop-webapppool -name "rubberduckvba-prod"
stop-webapppool -name "api-prod"
stop-iissite -name api-prod -confirm: $false
stop-iissite -name rubberduckvba-prod -confirm: $false
start-sleep -seconds 10
copy-item C:/pub/webroot/rubberduckvba.com/* C:/inetpub/wwwroot/rubberduckvba.com -Recurse -Force
copy-item C:/inetpub/appsettings.prod.json C:/inetpub/wwwroot/rubberduckvba.com/appsettings.json -Force
copy-item C:/inetpub/__Web.config C:/inetpub/wwwroot/rubberduckvba.com/wwwroot/browser/Web.config -Force
start-webapppool api-prod
start-iissite api-prod
start-webapppool rubberduckvba-prod
start-iissite rubberduckvba-prod