Release the packages
A push to main runs .github/workflows/release.yml. The release-please job opens or updates the release PR, "chore: release <branch>". When the release PR merges, the job creates the tags and the GitHub releases, and the publish job publishes to npm with OIDC. The publish job gives each released package the latest dist-tag. A prerelease gets next instead when the package already has a stable version on latest. So a package with no stable version gets its prereleases on latest, and a plain install gets them.
Do not run npm publish, npm trust or npm dist-tag yourself. The agent shell cannot do the npm web 2FA, so these commands fail with EOTP. Give the command to the user, with --otp=<code>, to run as ! <command>.
Merge a release PR
- Read the PR diff. Check the versions in
.release-please-manifest.jsonand the newCHANGELOG.mdentries. - Make sure that each public package exists on npm:
npm view <package> version. List the public packages withpnpm -r ls --json --depth -1 | jq -r '.[] | select(.private | not) | .name'. Thepublishjob has no npm token, so a package that it released before has a trusted publisher. A package with no version or with0.0.0-placeholderis new. Do "Publish a new package" for it first: one missing publisher fails the job. - Wait for the CI checks of the PR, then squash-merge it:
gh pr checks <number> --watch --fail-fast >/dev/null && gh pr merge <number> --squash --delete-branch. The watch prints the full table at each refresh, and its exit status is enough. CI runs on the PR when the secretRELEASE_PLEASE_TOKENis set. WithGITHUB_TOKENalone, the PR has no CI runs. - Watch the run in the background:
gh run watch <run-id> --exit-status. Thepublishjob waits until npm shows each version, and this can take 20 minutes. Find the ID withgh run list --workflow release.yml --branch <branch> --limit 1. - Check the dist-tags:
npm view <package> dist-tags --prefer-online. A green run already proves that npm shows each version.
If the publish job fails because of an external cause, such as the trusted publisher, the environment or an npm outage:
- Fix the cause.
- Run
gh run rerun <run-id> --failedwithin 30 days. pnpm skips the versions that are already on npm.
Do not use "Re-run all jobs". release-please then finds no pending release PR and skips publish. A re-run uses the workflow file and the code of the release commit. If the fix needs a code change, merge the fix and release a new version.
Control the version
- release-please writes the changelog from Conventional Commits.
!alone writes the subject as the breaking-change note. ABREAKING CHANGE:footer writes its text instead. - release-please adds a commit to the changelog of each package whose files it changes. It adds an empty commit to all packages.
linked-versionsgives core and the adapters the highest version in the group. A group member with no commits gets the same version.react-awesome-revealis not in the group.- A
Release-As: <version>footer applies to each package that the commit changes. Put it only on a commit that changes only the packages that get that version. - A squash merge gives the commit a blank body, so it drops the
Release-As:andBREAKING CHANGE:footers of the branch commits. release-please reads footers only from the commit body. Merge with the footer as the body, then check it withgit log -1 --format=%B:
```sh
gh pr merge <number> --squash --delete-branch --subject "<PR title> (#<number>)" --body "Release-As: 5.0.0"
```
release-asinrelease-please-config.jsonsets the version of a package that has afeat:,fix:or other visible commit since its last release. It does nothing without such a commit.linked-versionsstill applies the highest version in the group. It stays active until you remove it, so remove it in the first PR after the release. Prefer aRelease-As:footer.node-workspacebumpsreact-awesome-revealas a dependency update when only@awesome-reveal/reactchanges. That bump ignoresrelease-as, and it keeps the prerelease suffix. A visible commit on the compat package prevents it.- Keep
last-release-sha. It limits the commit walk for a package with no release yet, such as a new adapter.
Do a dry run
Push the branch first. The dry run reads the config and the commits from GitHub, not from the local checkout.
pnpm dlx release-please@17 release-pr --dry-run --token "$(gh auth token)" \
--repo-url awesome-reveal/awesome-reveal --target-branch <branch>
Check the versions, the changelog entries, and that the workspace: ranges stay unchanged. The action can bundle an older 17.x release than @17, so the result can differ a little.
Publish a new package
npm can add a trusted publisher only to a package that exists.
- Make a placeholder in the scratchpad: this
package.json, and a short README.
```json
{
"name": "@awesome-reveal/<framework>",
"version": "0.0.0-placeholder",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/awesome-reveal/awesome-reveal.git",
"directory": "packages/<framework>"
},
"publishConfig": { "access": "public" }
}
```
- Ask the user to publish it:
npm publish --tag placeholder --otp=<code>in that directory. npm refuses a prerelease without--tag. Use a prerelease placeholder: a stable placeholder keepslatest, sopnpm add <package>installs the empty placeholder. - Just before you merge the release PR, ask the user to add the trusted publisher. This needs npm 11.15 or later:
```sh
npm trust github <package> --file release.yml --repo awesome-reveal/awesome-reveal \
--env npm --allow-publish --yes --otp=<code>
```
- Merge the release PR within 48 hours. A new trusted publisher expires 48 hours after you create it, unless a publish uses it first. To replace an expired one, revoke it with
npm trust revoke --id <id> <package>, then create it again. - After the first release, ask the user to remove the placeholder:
npm dist-tag rm <package> placeholder --otp=<code>, thennpm unpublish <package>@0.0.0-placeholder --otp=<code>. After 72 hours, npm permits the unpublish only when all of these conditions are true:
- No other package depends on the package.
- The package had fewer than 300 downloads in the last week.
- The package has one maintainer.
The GitHub environment npm allows only the main branch. Add a branch there before you release from it.
Leave prerelease mode
- Remove
versioning,prereleaseandprerelease-typefromrelease-please-config.json. - In the same PR, set
release-ason each package to its stable version. ARelease-As:footer does not work here, because the commit changes no package files:
```json
"packages/core": { "component": "@awesome-reveal/core", "release-as": "1.0.0" }
```
- Make sure that these packages have a
feat:,fix:orRelease-As:commit since the last release:
react-awesome-reveal. Without one,node-workspacegives it a prerelease version (5.0.1-rc.N), and it goes tonext. Afix:commit that changes only this package and has aRelease-As: 5.0.0footer gives 5.0.0 in the dry run.- core or one adapter.
linked-versionsthen releases the full group.
- Do a dry run, and check that no version has a prerelease suffix. If a version has one, fix the cause from steps 1 to 3, push, and do the dry run again. Merge only when no version has a suffix.
- Merge the release PR. The
publishjob useslatest. - Remove
release-asin the first PR after the release.