ci: notify Discord when a new version is published - #335
Merged
Conversation
Hangs off the end of the publish job rather than a separate `on: release` workflow, so it reuses the version this run already computed instead of re-deriving it -- one source of truth for "what's a new version". continue-on-error so a failed notification never turns a green publish red, and if: success() so a failed publish stays silent. The repo is public, so the webhook URL is a secret (DISCORD_WEBHOOK), not a literal; the step skips quietly when it's absent (forks, outside contributors). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Notifies the Parity update Discord channel whenever a new version lands on npm.
Why a step in
publish.ymland not a new workflowThe step hangs off the end of the existing publish job instead of being its own
on: releaseworkflow, because that job has already computed the version — a separate workflow would have to re-derive "what's the new version", giving us two sources of truth for the thing most likely to drift.It only runs on
success(), so a failed publish stays silent, and it'scontinue-on-error: true: a notification failing must never turn a green publish red. The package is on npm either way; nobody seeing a Discord message is not a release failure.Secret, not a file
decocms/parityis public, so the webhook URL is not in the workflow — it's stored as theDISCORD_WEBHOOKrepo secret (already set). The step skips quietly when the secret is absent, which is the case on forks and for contributors without secret access.The payload is assembled with
jqrather than string-interpolated, since the version flows in from CI output and hand-rolled JSON breaks on quotes.Verified before merge
GET(returns the webhook object, posts nothing): channel Parity updatepublish.ymlparses as YAML, 11 stepsjqpayload emits valid JSONdiscord.com/api/webhooksstring anywhere in the fileNot yet verified: an actual delivered message. That happens on the next merge to
main— which this PR is, so this release is its own test.🤖 Generated with Claude Code
Summary by cubic
The publish workflow now notifies the Parity update Discord channel when a new
@decocms/parityversion reaches npm. Failed publishes stay silent, and a failed Discord notification does not affect the publish job.DISCORD_WEBHOOKand skips quietly when it is unavailable.Written for commit 8812431. Summary will update on new commits.