Skip to content

Commit 82951c6

Browse files
authored
fix(ci): send X-GitHub-Event on the CDN deploy webhook (#45)
## Related Issue No issue — the 0.13.1 release run failed in CI; the problem is described below. ## Problem The `Redeploy CDN` job of the 0.13.1 release reported success but deployed nothing, and `Verify release consistency` then failed after 600s with `cdn=0.13.0 latest=0.13.1`, so the release stayed invisible to installed clients. Two causes: 1. Dokploy's `extractBranchName` reads `body.ref` **only** when the request carries an `X-GitHub-Event` (or gitea/gitlab/bitbucket) header. Without it the branch resolves to `null`, the handler answers `301 {"message":"Branch Not Match"}` and no deploy is queued. 2. `301` is not an error status, so `curl --fail` did not trip and the job exited 0 — the failed deploy read as a successful one. Verified against the live webhook: the same POST plus `-H 'X-GitHub-Event: push'` answers `200 {"message":"Application deployed successfully"}`, and `https://code.pythinker.com/pythinker-code/latest.json` now serves `0.13.1`. The re-run of `Verify release consistency` on the release run is green. ## What changed - Send `X-GitHub-Event: push` with the Dokploy deploy webhook. - Capture the HTTP status and warn on anything that is not `2xx`, instead of relying on `--fail`, which cannot see a `301`. The job still never fails the workflow — `verify-cdn-release` remains the loud gate. ## Checklist - [x] I have read the CONTRIBUTING document. - [x] I have linked a related issue, or explained the problem above. - [x] I have added tests that prove my feature works. — not testable in the repo; verified against the live Dokploy webhook (200 + CDN now at 0.13.1). - [x] Ran `gen-changesets` skill, or this PR needs no changeset. — CI-only change, no package bump. - [x] Ran `gen-docs` skill, or this PR needs no doc update. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved CDN redeployment reliability by adding automatic retries. * Added clearer handling and warnings for unsuccessful webhook responses. * Ensured successful redeployments are recognized only for valid 2xx responses. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent ec98e74 commit 82951c6

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,21 +250,29 @@ jobs:
250250
exit 0
251251
;;
252252
esac
253-
# The webhook matches the branch from the request body: a bare POST
254-
# answers 301 {"message":"Branch Not Match"} and deploys nothing.
253+
# The webhook reads the branch from the body, but only when the
254+
# request also carries `X-GitHub-Event`: Dokploy's extractBranchName
255+
# returns null without that header, so the request answers
256+
# 301 {"message":"Branch Not Match"} and deploys nothing.
257+
#
258+
# 301 is not an error status, so `--fail` does not see it and curl
259+
# exits 0. Capture the status code and treat anything but 2xx as a
260+
# failed deploy.
255261
#
256262
# A transient failure must never fail the workflow. npm has already
257263
# published by now and that is irreversible, so dying here buys
258264
# nothing — an earlier version of this job was deleted because a
259265
# curl exit-28 timeout failed the 0.5.0 release. verify-cdn-release
260-
# polls the manifest and is the gate that fails loudly. `--fail` is
261-
# what makes an HTTP error status reach the retries and the warning
262-
# instead of exiting 0 and reading as a successful deploy.
263-
curl -sS --fail -X POST "$WEBHOOK" \
266+
# polls the manifest and is the gate that fails loudly.
267+
status=$(curl -sS -o /dev/stderr -w '%{http_code}' -X POST "$WEBHOOK" \
264268
-H 'Content-Type: application/json' \
269+
-H 'X-GitHub-Event: push' \
265270
-d '{"ref":"refs/heads/main"}' \
266-
--retry 3 --retry-all-errors --retry-delay 10 --max-time 60 \
267-
|| echo "::warning::CDN redeploy webhook failed — verify-cdn-release will catch a stale CDN."
271+
--retry 3 --retry-all-errors --retry-delay 10 --max-time 60) || status=000
272+
case "$status" in
273+
2*) echo "CDN redeploy triggered (HTTP $status)." ;;
274+
*) echo "::warning::CDN redeploy webhook returned HTTP $status — verify-cdn-release will catch a stale CDN." ;;
275+
esac
268276
269277
# Verifies that the published release is internally consistent and that the
270278
# CDN caught up with npm. It polls, so it must run after redeploy-cdn.

0 commit comments

Comments
 (0)