diff --git a/docs/development/releasing.md b/docs/development/releasing.md index 2bf7750..f286c67 100644 --- a/docs/development/releasing.md +++ b/docs/development/releasing.md @@ -13,19 +13,50 @@ repository contains one public root package and needs no build step. Actions secret, directly or through organization access. The App needs contents/actions write and pull requests read permissions. Repository rules must allow the App to create its version commits and tags. -2. Before publication, configure npm trusted publishing for +2. The package must exist on npm before configuring trusted publishing. For a new + package, complete [the first publication](#first-publication) with an account + allowed to publish under `@hoverkraft`. +3. Configure npm trusted publishing for `@hoverkraft/commitlint-config`, with organization `hoverkraft-tech`, repository `commitlint-config`, workflow filename `release.yml`, and no environment restriction. Allow direct publication. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/). - A package maintainer must establish package ownership and the first trusted - publisher on npm; creating this GitHub repository does not configure npm. -3. Optionally supply `CHANGELOG_SUMMARY` with the complete configuration accepted + Complete a successful workflow publication within two days to validate the + configuration. Recovering an existing npm version does not validate OIDC. + After verification, select "Require two-factor authentication and disallow + tokens" in the package's publishing access settings. +4. Optionally supply `CHANGELOG_SUMMARY` with the complete configuration accepted by the shared release workflow. Without it, releases use generated notes without an AI summary. Keep credentials in the secret, not in workflow files. The release workflow uses GitHub OIDC for npm authentication and does not use an -`NPM_TOKEN` secret. The package is public and publication includes provenance. +`NPM_TOKEN` secret. The package is public, and workflow publications include +provenance. + +## First publication + +Run the Release workflow on `main` to prepare a version and validate its tagged +source. Before the npm package exists, the trusted publishing step cannot succeed. +Keep the prepared version and tag; download the validated package tarball artifact +from that tag's workflow run. Check its package name, version and artifact digest, +and confirm the validation jobs passed before publishing it. + +Log in to npm with an account allowed to publish under `@hoverkraft`. Publish the +downloaded tarball, replacing the example path below with the actual artifact: + +```sh +npm login +npm publish ./validated-package.tgz --access public --tag latest --ignore-scripts +``` + +Complete npm's browser authentication when prompted. This manual first publication +does not have GitHub Actions provenance. Wait until npm serves the version and +verify its integrity against the downloaded artifact. Rerun the failed release jobs +at the same tag to recover the published version and finish the GitHub release. + +Configure the trusted publisher as described above, then publish the next version +through the workflow to verify OIDC and provenance. Use `force` only when +deliberately preparing a new version without releasable changes. ## Prepare, validate and publish