From d9c7e0d84f9573c5437cbb1182a74b48a2bc5f74 Mon Sep 17 00:00:00 2001 From: vivekashok1221 Date: Wed, 16 Aug 2023 12:18:23 +0530 Subject: [PATCH] CD: Add workflow for auto deployment. --- .github/workflows/deploy.yml | 13 +++++++++++++ .github/workflows/main.yml | 6 ++++++ 2 files changed, 19 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..bc3b25d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,13 @@ +name: Deploy to VPS + +on: workflow_call + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Trigger Watchtower on VPS + env: + WATCHTOWER_TOKEN: ${{ secrets.WATCHTOWER_TOKEN }} + run: | + curl -H "Authorization: Bearer $WATCHTOWER_TOKEN" https://watchtower.lnkshrt.xyz/v1/update diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c8bc5d..224165f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,3 +21,9 @@ jobs: with: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + + deploy: + if: github.ref == 'refs/heads/main' + needs: build-and-push + uses: ./.github/workflows/deploy.yml + secrets: inherit