ci: dispatch to unitsml/unitsdb-js on every unitsdb release#31
Merged
Conversation
After every release (which bumps lib/unitsdb/version.rb on main), fire a repository_dispatch (do-release) to unitsml/unitsdb-js so it can compile the new version via Opal and publish @unitsml/unitsdb to npm. unitsdb-js's release workflow is idempotent — it skips cleanly if a version is already on npm — so re-dispatching after a transient failure (or manual re-trigger) is always safe.
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.
Summary
Adds
notify-unitsdb-js.yml, a cross-repo trigger that firesrepository_dispatch(do-release) tounitsml/unitsdb-jseverytime
lib/unitsdb/version.rbchanges onmain.unitsml/unitsdb-jsis a new release-only repo that publishes theOpal-compiled
unitsdb-rubybundle to npm as@unitsml/unitsdb. Itwas created in conjunction with this change.
What happens end-to-end
release.yml(existing Cimas chain) bumpslib/unitsdb/version.rband tags
vX.Y.Zonmain.X.Y.Z, anddispatches
do-releasetounitsml/unitsdb-jswith payload{ version, ruby_ref }.unitsdb-js'srelease.ymlchecks outunitsdb-rubyatruby_ref, runs Opal, dumps the bundled database to JSON, wrapswith an esbuild-built TypeScript façade, and publishes
@unitsml/unitsdb@X.Y.Zto npm.Why this shape
cleanly separated; the Ruby repo stays the single source of truth.
repository_dispatch: matches the gated-chainpattern the Cimas release already uses for downstream consumers.
unitsdb-js's workflow checksnpm view @unitsml/unitsdb@VERSIONbefore publishing and skipscleanly if the version is already live. Re-dispatching after a
transient failure just works.
Required secrets
UNITSML_CI_PAT_TOKEN(already configured) — used bypeter-evans/repository-dispatch@v3for the cross-repo dispatch.NPM_TOKEN— must be set onunitsml/unitsdb-jsfor the publishstep. This is not yet in place; please add it before the next
unitsdb release goes out, otherwise the JS dispatch will fail at
the publish step.
Test plan
unitsdbpatch release will triggerunitsml/unitsdb-js'srelease.yml. Verify@unitsml/unitsdb@<version>appears on npm.workflow_dispatchonunitsdb-js) with an already-published version exits cleanlywith the skip warning.