Skip to content

Commit b9ce3c5

Browse files
authored
ci(deploy): Gotify success/fail heartbeat (ADR-0005) (#41)
Every deploy should emit a Gotify heartbeat (ADR-0005); infra had it, the web deploys were silent. Add success+failure notify steps, passing values via env (not inline ${{ }}) to avoid commit-message shell injection. No-op until the GOTIFY_URL secret is set.
1 parent fb748f0 commit b9ce3c5

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,36 @@ jobs:
4848
-e "ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=yes" \
4949
docs/ \
5050
"${VPS_USER}@${VPS_HOST}:/opt/jellyrock/api-docs/"
51+
52+
# Deploy heartbeat (ADR-0005). Values passed via env, never inlined into
53+
# the script, to avoid commit-message shell injection. No-op until the
54+
# GOTIFY_URL secret is set.
55+
- name: Notify Gotify on success
56+
if: success()
57+
env:
58+
GOTIFY_URL: ${{ secrets.GOTIFY_URL }}
59+
REPO: ${{ github.event.repository.name }}
60+
COMMIT_MSG: ${{ github.event.head_commit.message }}
61+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
62+
run: |
63+
[ -z "$GOTIFY_URL" ] && { echo "GOTIFY_URL unset — skipping"; exit 0; }
64+
curl -fsS -m 10 "$GOTIFY_URL" \
65+
-F "priority=3" \
66+
-F "title=${REPO} deploy ok" \
67+
-F "message=Commit: ${COMMIT_MSG}
68+
Run: ${RUN_URL}" || true
69+
70+
- name: Notify Gotify on failure
71+
if: failure()
72+
env:
73+
GOTIFY_URL: ${{ secrets.GOTIFY_URL }}
74+
REPO: ${{ github.event.repository.name }}
75+
COMMIT_MSG: ${{ github.event.head_commit.message }}
76+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
77+
run: |
78+
[ -z "$GOTIFY_URL" ] && exit 0
79+
curl -fsS -m 10 "$GOTIFY_URL" \
80+
-F "priority=8" \
81+
-F "title=${REPO} deploy FAILED" \
82+
-F "message=Commit: ${COMMIT_MSG}
83+
Run: ${RUN_URL}" || true

0 commit comments

Comments
 (0)