From dd640cbb640fef9d790c90169cce466cb87ba3c3 Mon Sep 17 00:00:00 2001 From: Joshua Slui Date: Tue, 2 Jul 2024 13:54:42 +0200 Subject: [PATCH] Create deploy.yml --- .github/workflows/deploy.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..74508a0 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,31 @@ +name: Deploy to VPS + +on: + release: + types: [published] + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up SSH + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE }} + + + - name: Deploy to VPS + run: | + ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }} << 'EOF' + cd pingernos + git pull origin Python + venv/bin/pip install -r requirements.txt + WATCH_MODE=$(pm2 jlist | jq -r '.[] | select(.name == "pingernos") | .pm2_env.watch') + if [[ "$WATCH_MODE" != "true" ]]; then + pm2 restart pingernos --watch + fi + EOF