From ba351a0f80878981f2d7135420d04a85f6c33214 Mon Sep 17 00:00:00 2001 From: lakshit verma Date: Mon, 31 Aug 2026 22:02:27 +0000 Subject: [PATCH] ci: add deploy workflow (build linux/amd64 to GHCR + SSH deploy to VPS) --- .github/workflows/deploy.yml | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 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..eee54aa --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,43 @@ +name: deploy +on: + push: + branches: [main] + paths: ["**", ".github/workflows/deploy.yml"] + workflow_dispatch: +permissions: + contents: read + packages: write +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64 + push: true + tags: ghcr.io/vee1e/subidx:latest + cache-from: type=gha + cache-to: type=gha,mode=max + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - uses: appleboy/ssh-action@v1 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + key: ${{ secrets.DEPLOY_SSH_KEY }} + port: 7576 + script: | + cd /srv/personal-apps + docker compose pull subidx + docker compose up -d --no-deps subidx + docker image prune -f