From 47273666ec09a87416fe25da8103b8e98581529f Mon Sep 17 00:00:00 2001 From: Carlos Date: Sat, 31 Jan 2026 11:39:58 -0800 Subject: [PATCH] feat: auto-deploy to production after images are built MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a deploy job that automatically deploys to production after both frontend and backend images are built and pushed to GHCR. The deploy job: - Waits for both build jobs to complete - Uses the production environment (for SSH credentials) - Runs deploy.sh with the commit SHA as the image tag - Provides a deployment summary in the workflow This makes deployment fully automatic: push to main → build → deploy. Co-Authored-By: Claude Opus 4.5 --- .github/workflows/docker.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 50b40fae..0e77d777 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -69,3 +69,28 @@ jobs: ghcr.io/ccextractor/backend:${{ github.sha }} cache-from: type=gha cache-to: type=gha,mode=max + + deploy: + needs: [build-and-push-frontend, build-and-push-backend] + runs-on: ubuntu-latest + environment: production + + steps: + - name: Deploy to VPS + uses: appleboy/ssh-action@v1.2.0 + with: + host: ${{ vars.SSH_HOST }} + username: ${{ vars.SSH_USER }} + key: ${{ secrets.DEPLOY_SSH_KEY }} + port: ${{ vars.SSH_PORT }} + command_timeout: 10m + script: | + /opt/ccsync/scripts/deploy.sh ${{ github.sha }} + + - name: Deployment summary + run: | + echo "## Deployment Complete" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "- **Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY + echo "- **Branch:** ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY + echo "- **Server:** https://taskwarrior-server.ccextractor.org" >> $GITHUB_STEP_SUMMARY