-
Notifications
You must be signed in to change notification settings - Fork 3
102 lines (78 loc) · 2.36 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
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
name: Build & deploy
on:
push:
branches: [master]
#tags: ["**"]
paths:
- ingest/**
- UwuRadio.Server/**
- UwuRadio.Server.Tests/**
- uwu-radio.sln
workflow_dispatch:
jobs:
build:
name: Build server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
- name: Test ingests are valid
run: dotnet test
- name: Publish
run: |
cd UwuRadio.Server
dotnet publish -r linux-x64 --self-contained -c Release -p:PublishSingleFile=true
mkdir ../dist
cp bin/Release/net*/*/publish/UwuRadio.Server ../dist
cp bin/Release/net*/*/publish/appsettings.json ../dist
cp constants.json ../dist
- uses: actions/upload-artifact@v3
with:
name: linux-x64-build
path: dist
deploy:
name: Deploy server
runs-on: ubuntu-latest
needs: build
#if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
with:
name: linux-x64-build
path: dotnet-dist
- name: Prepare dist directory
run: |
mkdir dist
cp -r ingest dist/ingest
cp dotnet-dist/* dist
wget "https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux"
mv yt-dlp_linux dist/yt-dlp
- name: SCP dist to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSHHOST }}
username: ${{ secrets.SSHUSER }}
key: ${{ secrets.SSHPRIVKEY }}
rm: true
source: "dist/*"
target: "/tmp/uwuradio-tmp"
- name: Restart instance on server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSHHOST }}
username: ${{ secrets.SSHUSER }}
key: ${{ secrets.SSHPRIVKEY }}
script: |
systemctl --user stop server.service
rm -rf ~/server
mv /tmp/uwuradio-tmp ~/server
cd ~/server
mv dist/* .
rmdir dist
chmod +x UwuRadio.Server
chmod +x yt-dlp
systemctl --user start server.service