Skip to content

chore: migrate to npm trusted publishing and GitHub App token#186

Merged
dividedmind merged 1 commit intomainfrom
chore/trusted-publishing
Feb 26, 2026
Merged

chore: migrate to npm trusted publishing and GitHub App token#186
dividedmind merged 1 commit intomainfrom
chore/trusted-publishing

Conversation

@dividedmind
Copy link
Collaborator

  • Replace PAT with GitHub App token (RELEASE_BOT_APP_ID/PRIVATE_KEY) in release job; app token events trigger other workflows unlike GITHUB_TOKEN
  • Remove npm publish from semantic-release; add separate publish.yml workflow triggered on version tags using OIDC (no NPM_TOKEN needed)
  • Drop id-token: write and write permissions from release job (governed by app installation, not workflow permissions block)
  • Add windows-test to release job dependencies
  • Remove @semantic-release/npm plugin from .releaserc.yaml

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the release and publishing workflow by migrating from Personal Access Token (PAT) authentication to GitHub App tokens, and separating npm publishing into a dedicated workflow using OIDC-based trusted publishing. The changes improve security by eliminating the need for a long-lived NPM_TOKEN secret and enable proper workflow triggering.

Changes:

  • Replaced PAT-based authentication with GitHub App token (using RELEASE_BOT_APP_ID/PRIVATE_KEY) in the release job to enable workflow-triggering events
  • Removed npm publishing from semantic-release configuration and created a separate publish.yml workflow that uses OIDC for trusted publishing
  • Updated release job permissions and added windows-test as a dependency

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
.releaserc.yaml Removed @semantic-release/npm plugin to separate npm publishing from the release process
.github/workflows/publish.yml New workflow that publishes to npm using OIDC trusted publishing when version tags are pushed
.github/workflows/ci.yml Updated release job to use GitHub App token, removed npm-related configuration, added windows-test dependency, removed prepack step (no longer needed for semantic-release)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
- run: yarn
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The publish workflow is missing the build step before publishing. The package.json specifies that only the /dist directory should be published (line 14-16 in package.json), but /dist is gitignored and needs to be built from TypeScript sources using yarn prepack. Without running yarn prepack before npm publish, the package will be published without the compiled JavaScript files, causing the publish to fail or publish an incomplete package.

Add - run: yarn prepack after the - run: yarn step to compile TypeScript to the /dist directory before publishing.

Suggested change
- run: yarn
- run: yarn
- run: yarn prepack

Copilot uses AI. Check for mistakes.
on:
push:
tags:
- 'v[0-9]*'
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The tag trigger pattern 'v[0-9]' is too permissive and will match tags like 'v1', 'v12', etc., not just semantic version tags. Since the semantic-release configuration uses tagFormat 'v${version}' (line 2 of .releaserc.yaml) which produces tags like 'v1.2.3', consider using a more specific pattern like 'v[0-9]+.[0-9]+.[0-9]+' or 'v..' to ensure the publish workflow only triggers on valid semantic version tags.

Suggested change
- 'v[0-9]*'
- 'v*.*.*'

Copilot uses AI. Check for mistakes.
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The publish workflow doesn't specify a Node.js version in the setup-node step, while the package.json requires "node": ">=18" (line 43 of package.json). Consider explicitly setting the node-version to ensure compatibility, for example:

- uses: actions/setup-node@v4
  with:
    node-version: '18'
    registry-url: 'https://registry.npmjs.org'

This ensures the build and publish happen with a supported Node.js version.

Suggested change
with:
with:
node-version: '18'

Copilot uses AI. Check for mistakes.
- Replace PAT with GitHub App token (RELEASE_BOT_APP_ID/PRIVATE_KEY) in
  release job; app token events trigger other workflows unlike GITHUB_TOKEN
- Remove npm publish from semantic-release; add separate publish.yml
  workflow triggered on version tags using OIDC (no NPM_TOKEN needed)
- Drop id-token: write and write permissions from release job (governed
  by app installation, not workflow permissions block)
- Add windows-test to release job dependencies
- Remove @semantic-release/npm plugin from .releaserc.yaml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dividedmind dividedmind force-pushed the chore/trusted-publishing branch from 85cb764 to 4439a6b Compare February 26, 2026 15:33
@dividedmind dividedmind merged commit a0b1637 into main Feb 26, 2026
6 checks passed
@dividedmind dividedmind deleted the chore/trusted-publishing branch February 26, 2026 15:35
@appmap-releasebot
Copy link

🎉 This PR is included in version 2.25.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@appmap-releasebot
Copy link

🎉 This PR is included in version 2.25.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

1 similar comment
@appmap-releasebot
Copy link

🎉 This PR is included in version 2.25.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants