Skip to content

add protected npm publishing - #1

Merged
kopachlager merged 1 commit into
mainfrom
agent/add-protected-npm-publishing
Jul 23, 2026
Merged

add protected npm publishing#1
kopachlager merged 1 commit into
mainfrom
agent/add-protected-npm-publishing

Conversation

@kopachlager

Copy link
Copy Markdown
Owner

What changed

  • add a release-triggered npm trusted-publishing workflow
  • verify release tags match the package version
  • test workflow permissions, repository restrictions, validation steps, provenance, and token absence

Why

This prepares future MCP package releases to publish through npm OIDC with minimal permissions and without a long-lived npm token.

Validation

  • npm ci --ignore-scripts
  • npm test
  • npm run test:coverage
  • npm run check
  • npm run pack:check
  • npm audit --omit=dev
  • git diff --check

@kopachlager
kopachlager marked this pull request as ready for review July 23, 2026 20:13
@kopachlager
kopachlager merged commit 1e406ab into main Jul 23, 2026
3 checks passed
@kopachlager
kopachlager deleted the agent/add-protected-npm-publishing branch July 23, 2026 20:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 290f551ef0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: "24"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install an npm CLI that supports trusted publishing

When this job runs with the npm version bundled by the selected Node 24 release, publishing can fail before uploading because no npm token is provided and older npm clients do not implement trusted-publisher authentication; for example, the inspected Node 24.15.0 distribution contains npm 11.4.2. The npm trusted-publishing documentation requires npm CLI 11.5.1 or later, so explicitly install a supported npm version instead of assuming node-version: "24" supplies one.

Useful? React with 👍 / 👎.

exit 1
fi
- name: Publish to npm with trusted publishing
run: npm publish --provenance --access public

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Route prereleases away from the latest dist-tag

When a GitHub prerelease is published, the release: published trigger also invokes this job and the version check accepts prerelease versions, but this command omits --tag. The npm CLI documentation states that publishing sets latest unless --tag is used, so a beta or release candidate would become the default version installed by users; either skip prereleases or publish them under a non-latest tag.

Useful? React with 👍 / 👎.

Comment thread test/release.test.js
Comment on lines +25 to +27
test('release version is 0.1.0', async () => {
const packageJson = JSON.parse(await readFile(packagePath, 'utf8'));
assert.equal(packageJson.version, '0.1.0');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stop pinning the package version in the test

On the next legitimate version bump, npm test in both CI and this release workflow will fail solely because this assertion still requires 0.1.0, even when package.json, the lockfile, and the release tag agree. This makes every future release depend on updating an unrelated test constant; validate version consistency or SemVer shape instead of freezing the current release number.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant