[ingest > sink] add gravity 2021 bootlegs #226
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |