-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (43 loc) · 1.53 KB
/
deploy.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
name: Deploy
on:
push:
branches: [ "master" ]
jobs:
deploy:
runs-on: ubuntu-latest
env:
Solution_Name: SU.LorePage.sln
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet publish -c Release -r linux-x64 --self-contained true
- name: Install SSH Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Prepare files for deployment
run: |
mkdir deploy
rsync -av --exclude='bin' --exclude='obj' --exclude='.git' --exclude='.github' ./ deploy/
- name: Upload to remote server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SSH_USER }}
key : ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
source: "deploy/*"
target: "/home/SS14/LorePage"
- name: Stop previous
run: |
ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} "pkill -q -f LorePage"
- name: Start
run: |
ssh -o StrictHostKeyChecking=no -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} "nohup dotnet run --project /home/${{ secrets.SSH_USER }}/LorePage/deploy/SU.LorePage/SU.LorePage.csproj > /home/${{ secrets.SSH_USER }}/LorePage/app.log 2>&1 &"