From a2d2cab73b5cf5b8d0d681aef3ebe58b6eee6a6a Mon Sep 17 00:00:00 2001 From: hermes Date: Mon, 31 Aug 2026 14:40:03 +0000 Subject: [PATCH] feat(ci): add auto-deploy workflow via brencher action Adds .github/workflows/deploy.yml that triggers on PR approval (or manual dispatch) and invokes the brencher reusable action from admin/brencher to: 1. Build the reverseproxy image and push it to registry.rudolf.keenetic.link with an auto- tag. 2. SSH to the swarm manager, reset the deploy branch (deploy/torrserv_proxy) to origin, and run 'docker stack deploy --prune --resolve-image-always' against docker-compose.yml. First end-to-end pilot of the auto-deploy design (see admin/brencher#24 for context). --- .github/workflows/deploy.yml | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 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..b520677 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,47 @@ +name: build-and-deploy + +on: + pull_request_review: + types: [submitted] + workflow_dispatch: + +permissions: + contents: read + +jobs: + deploy: + runs-on: ubuntu-latest + if: | + github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request_review' && + github.event.review.state == 'approved' && + github.event.review.author_association == 'OWNER') + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + + - name: Build, push, deploy + uses: admin/brencher/.github/actions/brencher@main + with: + registry: gitea.rudolf.keenetic.link + image_name: admin/reverseproxy + stack_name: torrserv_proxy + compose_path: docker-compose.yml + swarm_manager_host: ${{ secrets.SWARM_MANAGER_HOST }} + swarm_ssh_user: ${{ secrets.SWARM_SSH_USER }} + swarm_ssh_key: ${{ secrets.SWARM_SSH_KEY }} + registry_username: ${{ secrets.REGISTRY_USERNAME }} + registry_password: ${{ secrets.REGISTRY_PASSWORD }} + deploy_branch: deploy/torrserv_proxy + + - name: Comment on PR + if: github.event_name == 'pull_request_review' && github.event.review.state == 'approved' + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: brencher-deploy + message: | + ✅ Deployed `torrserv_proxy` at `${{ github.event.pull_request.head.sha || github.sha }}` + - triggered by: @${{ github.event.review.user.login }}