Skip to content

mong us

mong us #35

Workflow file for this run

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/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Prepare files for deployment
run: |
mkdir deploy
echo '${{ vars.DEPLOY_APPSETTINGS }}' > ./SU.LorePage/appsettings.json
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 -f 'dotnet run --project /home/${{ secrets.SSH_USER }}/LorePage/deploy/SU.LorePage/SU.LorePage.cspro'"
- 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 &"