From 7c4ebab8aaec64c17047de09cb502d8212fcf276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delucchi?= Date: Fri, 12 Apr 2024 20:46:45 +0200 Subject: [PATCH] feat: add lichess.yml and vps-deploy.yml --- .github/workflows/lichess.yml | 27 +++++++++++++++++++++++++++ .github/workflows/vps-deploy.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .github/workflows/lichess.yml create mode 100644 .github/workflows/vps-deploy.yml diff --git a/.github/workflows/lichess.yml b/.github/workflows/lichess.yml new file mode 100644 index 0000000..46c7a84 --- /dev/null +++ b/.github/workflows/lichess.yml @@ -0,0 +1,27 @@ +name: Restart lichess-bot service + +run-name: Restart lichess-bot by @${{ github.actor }} + +on: + workflow_run: + workflows: ["Deploy to VPS on push"] + types: + - completed + branches: + - master + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Restart lichess-bot service + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + script_stop: true + script: | + echo ${{secrets.PASSWORD}} | sudo -S systemctl restart lichess-bot.service \ No newline at end of file diff --git a/.github/workflows/vps-deploy.yml b/.github/workflows/vps-deploy.yml new file mode 100644 index 0000000..4ba269b --- /dev/null +++ b/.github/workflows/vps-deploy.yml @@ -0,0 +1,26 @@ +name: Deploy to VPS on push + +run-name: Deploy to VPS by @${{ github.actor }} + +on: + push: + branches: + - master + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Pull and build + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + script_stop: true + script: | + cd /home/${{ secrets.USERNAME }}/Victoire + git pull origin master + zig build -Doptimize=ReleaseFast