-
Notifications
You must be signed in to change notification settings - Fork 0
Prepare npm release readiness #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: NPM Release | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| enable_publish: | ||
| description: Set to true only after RELEASE.md is complete and package privacy has been intentionally changed. | ||
| required: true | ||
| default: false | ||
| type: boolean | ||
| expected_version: | ||
| description: Optional package.json version expected for this release. | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Verify npm release artifact | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@v6 | ||
| with: | ||
| version: 10.24.0 | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 22 | ||
| cache: pnpm | ||
| registry-url: https://registry.npmjs.org | ||
|
|
||
| - name: Install | ||
| run: pnpm install --frozen-lockfile | ||
|
|
||
| - name: Test | ||
| run: pnpm test | ||
|
|
||
| - name: Typecheck | ||
| run: pnpm typecheck | ||
|
|
||
| - name: Lint | ||
| run: pnpm lint | ||
|
|
||
| - name: Build | ||
| run: pnpm build | ||
|
|
||
| - name: Verify packed CLI | ||
| run: pnpm verify:packed | ||
|
|
||
| - name: Verify release metadata | ||
| env: | ||
| EXPECTED_VERSION: ${{ inputs.expected_version }} | ||
| run: | | ||
| node <<'NODE' | ||
| const packageJson = require('./package.json'); | ||
| if (packageJson.name !== '@mattbaconz/kernel') { | ||
| throw new Error(`Unexpected package name: ${packageJson.name}`); | ||
| } | ||
| if (packageJson.publishConfig?.access !== 'public') { | ||
| throw new Error('Expected publishConfig.access to be public.'); | ||
| } | ||
| if (process.env.EXPECTED_VERSION && packageJson.version !== process.env.EXPECTED_VERSION) { | ||
| throw new Error(`Expected version ${process.env.EXPECTED_VERSION}, got ${packageJson.version}.`); | ||
| } | ||
| console.log(`package: ${packageJson.name}@${packageJson.version}`); | ||
| console.log(`private: ${String(packageJson.private)}`); | ||
| NODE | ||
|
|
||
| - name: Pack dry run | ||
| run: npm pack --dry-run --json | ||
|
|
||
| - name: Refuse publish by default | ||
| if: ${{ inputs.enable_publish != true }} | ||
| run: | | ||
| echo "Publication disabled. Set enable_publish=true only after RELEASE.md is complete." | ||
| echo "No npm publish command was run." | ||
|
|
||
| - name: Verify publish gate | ||
| if: ${{ inputs.enable_publish == true }} | ||
| run: | | ||
| node <<'NODE' | ||
| const packageJson = require('./package.json'); | ||
| if (packageJson.private) { | ||
| throw new Error('Refusing to publish while package.json private=true. Remove private:true in a separate release task.'); | ||
| } | ||
| NODE | ||
|
|
||
| - name: Publish to npm | ||
| if: ${{ inputs.enable_publish == true }} | ||
| run: npm publish --access public | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # Release Checklist | ||
|
|
||
| Kernel is not published to npm yet. This checklist prepares `@mattbaconz/kernel` for a future public npm release without enabling publication now. | ||
|
|
||
| ## Current Gate | ||
|
|
||
| - Do not publish while `package.json` has `"private": true`. | ||
| - Do not remove `"private": true` except in a dedicated npm publication task. | ||
| - Do not publish from the private `mattbaconz/kernel-skills` repository. | ||
| - Use the public `mattbaconz/kernel` repository as the trusted publishing source. | ||
|
|
||
| ## Package Metadata | ||
|
|
||
| - Package name: `@mattbaconz/kernel` | ||
| - License: Apache-2.0 | ||
| - Copyright: `Copyright 2026 mattbaconz` | ||
| - Package files: `dist/` and `schemas/` | ||
| - Public package access: configured with `publishConfig.access: public` | ||
| - npm package remains unpublished until a separate explicit release task. | ||
|
|
||
| ## Required Verification | ||
|
|
||
| Run these checks before any release tag or npm publication: | ||
|
|
||
| ```bash | ||
| pnpm install --frozen-lockfile | ||
| pnpm test | ||
| pnpm typecheck | ||
| pnpm lint | ||
| pnpm build | ||
| pnpm verify:packed | ||
| npm pack --dry-run --json | ||
| ``` | ||
|
|
||
| Review the dry-run package contents and confirm they include only expected files: | ||
|
|
||
| - `LICENSE` | ||
| - `README.md` | ||
| - `package.json` | ||
| - `dist/` | ||
| - `schemas/` | ||
|
|
||
| ## Trusted Publishing | ||
|
|
||
| Preferred release path is npm Trusted Publishing from GitHub Actions, not a long-lived npm token. | ||
|
|
||
| Before enabling publication: | ||
|
|
||
| 1. Configure npm trusted publishing for `@mattbaconz/kernel`. | ||
| 2. Set the trusted publisher to the public GitHub repository `mattbaconz/kernel`. | ||
| 3. Set the workflow file to `.github/workflows/npm-release.yml`. | ||
| 4. Confirm the workflow has `id-token: write`. | ||
| 5. Confirm npm package ownership and 2FA settings for the `mattbaconz` account. | ||
|
|
||
| Trusted publishing uses OIDC. With trusted publishing, npm generates provenance attestations automatically. If trusted publishing is not available, do not fall back to a broad token without a separate release security review. | ||
|
|
||
| ## Manual Workflow | ||
|
|
||
| The manual workflow `.github/workflows/npm-release.yml` is intentionally gated. | ||
|
|
||
| Default behavior: | ||
|
|
||
| - verifies the release artifact | ||
| - runs `npm pack --dry-run --json` | ||
| - refuses to publish because `enable_publish` defaults to `false` | ||
|
|
||
| Publication behavior: | ||
|
|
||
| - requires manual `workflow_dispatch` | ||
| - requires `enable_publish: true` | ||
| - refuses to publish while `package.json` has `"private": true` | ||
| - uses `npm publish --access public` only after the gates above pass | ||
|
|
||
| ## Tag And Release | ||
|
|
||
| Before npm publication: | ||
|
|
||
| 1. Confirm `CHANGELOG.md` has the intended version notes. | ||
| 2. Confirm `package.json` version matches the release tag. | ||
| 3. Create or verify the release tag, for example `v0.1.0`. | ||
| 4. Confirm public CI is green on the tagged commit. | ||
| 5. Create a GitHub Release after the tag is final. | ||
|
|
||
| ## Rollback | ||
|
|
||
| npm packages cannot be treated like normal mutable deploys. | ||
|
|
||
| Use this rollback section for containment and follow-up when a release is wrong. | ||
|
|
||
| If a bad package is published: | ||
|
|
||
| 1. Stop further publication. | ||
| 2. Open a security or release issue if user impact is possible. | ||
| 3. Deprecate the bad version on npm if appropriate. | ||
| 4. Publish a fixed patch version instead of replacing the bad version. | ||
| 5. Record evidence in the private source repository. |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The publish path is configured around npm Trusted Publishing, but this job pins
node-version: 22, and Node 22 currently ships npm 10.x; npm’s trusted-publisher flow requires npm CLI 11.5.1+ to exchange OIDC tokens, sonpm publishcan fail with auth errors once token-based publishing is disabled as described inRELEASE.md. This means the workflow can pass all verification gates and still be unable to publish in the intended secure mode unless npm is explicitly upgraded (or Node 24 is used).Useful? React with 👍 / 👎.