-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (69 loc) · 2.41 KB
/
Copy pathmain.yml
File metadata and controls
80 lines (69 loc) · 2.41 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
name: Deploy MultiSourceContentDelivery
on:
push:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore the application
run: dotnet restore
- name: Build the application
run: |
dotnet publish -f net8.0 -c Release -r linux-x64 --self-contained false /p:PublishSingleFile=true
- name: Remove extra files
run: |
cd ./bin/Release/net8.0/linux-x64/publish/
rm -f *.pdb
rm -f *.json
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: MultiSourceContentDelivery-Release-linux-x64
path: ./bin/Release/net8.0/linux-x64/publish/
deploy:
needs: publish
strategy:
fail-fast: false
matrix:
location: [hangzhou, ningbo, shiyan]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: MultiSourceContentDelivery-Release-linux-x64
path: ./deploy-package
- name: Remove excluded files
run: |
find ./deploy-package -name "appsettings*.json" -delete
- name: Stop remote service
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets[format('{0}_SERVER', matrix.location)] }}
username: ${{ secrets[format('{0}_USERNAME', matrix.location)] }}
password: ${{ secrets[format('{0}_KEY', matrix.location)] }}
script: sudo supervisorctl stop mcdn-service
- name: Deploy via SFTP
uses: wlixcc/SFTP-Deploy-Action@v1.2.5
with:
server: ${{ secrets[format('{0}_SERVER', matrix.location)] }}
username: ${{ secrets[format('{0}_USERNAME', matrix.location)] }}
password: ${{ secrets[format('{0}_KEY', matrix.location)] }}
local_path: './deploy-package/*'
remote_path: '/www/mcdn'
- name: Start remote service
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets[format('{0}_SERVER', matrix.location)] }}
username: ${{ secrets[format('{0}_USERNAME', matrix.location)] }}
password: ${{ secrets[format('{0}_KEY', matrix.location)] }}
script: sudo supervisorctl start mcdn-service