Repository navigation
Release regenerations without hands - #6
Merged
Merged
Conversation
A regeneration pull request sets the next version (scripts/version.sh bump: minor when the API moved, patch otherwise), merge-regeneration.yml merges it once CI passes when every commit in it is the workflow's, and release.yml publishes the version to npm with trusted publishing once CI passes on main, then tags it. The regeneration pushes with the regeneration App's token when it is configured, so that CI and the release run.
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.
Context
A change of the API should reach a released SDK without anyone's hands. Today the regeneration pull request waits for a person to merge it, and a release is published to npm by hand.
Approach
Version.
regenerate.ymlsets the next version in its pull request withscripts/version.sh bump, then runsnpm install --package-lock-only. The version lives in:version;@origincloud/corepeer and development dependency of each service package;VERSIONinpackages/core/src/client.ts.It is a minor version when
API_REVISIONmoved, a patch for a change of the generator alone. A pending bump that isn't released yet stays; a minor one replaces a pending patch.Merge.
merge-regeneration.ymlruns when CI completes on theregeneratebranch. It merges when CI passed on the head commit and every commit is the regeneration workflow's, unless the pull request adds a directory underpackages/. That pull request gets a comment and waits, because a new service's package is added by hand and its first version is published by hand.Release.
release.ymlruns when CI passes on a push tomain. If the version has no tag yet, and is newer than every tag, it builds and publishes to npm with trusted publishing from the environmentrelease, so npm attaches each package's provenance.@origincloud/coregoes first, then the service packages.Credential. The regeneration's push and the merge use a GitHub App's token (variable
REGENERATE_APP_ID, secretREGENERATE_APP_PRIVATE_KEY). Without the App, the regeneration works as before, dispatching CI itself, and the merge stays by hand.RELEASING.md describes the automatic path, a new package's first publish, and the manual path.
Before it can release
@origincloud/core,@origincloud/pvsand@origincloud/location0.1.0 are on npm andv0.1.0is tagged. Each package needs this repository as its trusted publisher on npmjs.com (workflowrelease.yml, environmentrelease) before the next version is released.Trade-offs / risks
A bot-only regeneration merges and releases with no review in this repository. It holds only what the generator makes from a reviewed API change, and CI, including
npm pack --dry-runand the tests on Node 20, 22 and 24, checks it. The release runs on Node 24, because trusted publishing needs npm 11.5.1 or later.How to test
A real bump (
scripts/version.sh bump minor, thennpm install --package-lock-only) moved every version line, the lockfile's workspace entries andVERSIONto 0.2.0, andnpm testpassed against it, including the test thatVERSIONmatches each package.npm publish --dry-run --workspace @origincloud/pvsfrom the root packs the workspace package as expected. The registry checks the release uses answered 200 for a published version and 404 for an unpublished version or package.