Skip to content

Commit feb5960

Browse files
Gjessing1claude
andcommitted
ci: auto-deploy on host after successful main build
Append a deploy job that pulls the just-pushed git.gjessing.io image and restarts the compose stack via the host Docker socket. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9bc0400 commit feb5960

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

.forgejo/workflows/docker.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,25 @@ jobs:
5252
SHA_TAG="${GITHUB_SHA::7}"
5353
docker push "$PUSH_IMAGE:latest"
5454
docker push "$PUSH_IMAGE:$SHA_TAG"
55+
56+
# Redeploy on the host after a successful main build. Runs against the host
57+
# daemon via the mounted Docker socket; the deploy project (compose file +
58+
# .env) is bind-mounted into the job by the runner. Pulls git.gjessing.io/...
59+
# :latest — the image this workflow just pushed.
60+
deploy:
61+
needs: build-and-push
62+
if: github.ref == 'refs/heads/main'
63+
runs-on: docker
64+
env:
65+
DEPLOY_DIR: /home/gjessing/docker/syncthing-resolver
66+
steps:
67+
- name: Registry auth
68+
run: |
69+
mkdir -p ~/.docker
70+
auth=$(printf 'gjessing1:%s' "${{ secrets.REGISTRY_TOKEN }}" | base64 -w0)
71+
printf '{"auths":{"git.gjessing.io":{"auth":"%s"}}}' "$auth" > ~/.docker/config.json
72+
- name: Pull and restart
73+
run: |
74+
cd "$DEPLOY_DIR"
75+
docker compose pull
76+
docker compose up -d --remove-orphans

0 commit comments

Comments
 (0)