Skip to content

ci: switch npm publish to OIDC trusted publishing#8454

Open
jamadeo wants to merge 6 commits intomainfrom
jamadeo/npm-trusted-publish
Open

ci: switch npm publish to OIDC trusted publishing#8454
jamadeo wants to merge 6 commits intomainfrom
jamadeo/npm-trusted-publish

Conversation

@jamadeo
Copy link
Copy Markdown
Member

@jamadeo jamadeo commented Apr 9, 2026

Summary

Switch the npm publish workflow from using a long-lived NPM_PUBLISH_TOKEN secret to OIDC-based trusted publishing. GitHub Actions now authenticates directly with npm using short-lived OIDC tokens issued to the npm-production-publishing environment, eliminating the need for stored npm access tokens.

Changes:

  • Added environment: npm-production-publishing to the release job
  • Removed the Configure npm authentication step that wrote the token to .npmrc
  • Removed NODE_AUTH_TOKEN / NPM_PUBLISH_TOKEN references from the publish step
  • Added --provenance flag directly to pnpm publish

Testing

Requires a dry-run workflow dispatch to verify OIDC token issuance works end-to-end. The npm-production-publishing environment claims have already been configured on npm.

Related Issues

N/A

Copy link
Copy Markdown

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

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: 399c29f2fe

ℹ️ 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".

- Add workflow_call trigger to publish-npm.yml so it can be called
  from release.yml
- Remove the push-to-main trigger (publishing now only happens via
  release.yml or manual workflow_dispatch)
- Add publish-npm job to release.yml after the release job
- Simplify publish conditions to only check dry-run input (the
  environment deployment branch rules handle branch protection)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

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

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: 3c06df7a2b

ℹ️ 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".

Comment on lines +154 to +156
publish-npm:
needs: [release]
uses: ./.github/workflows/publish-npm.yml
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 Allow release tags to reach npm publish workflow

This new call wires npm publishing into the tag-based Release pipeline, but the called workflow now enforces the npm-production-publishing environment, whose own header docs specify deployment is restricted to branch main; for release runs triggered from refs/tags/v1.*, that environment gate will reject the job before publish executes. In practice, this means tagged releases can create GitHub releases while npm publication is blocked, so the release flow becomes partially broken.

Useful? React with 👍 / 👎.

- Remove build-goose-binaries job; fetch pre-built binaries from
  GitHub release instead using gh release download
- Add required release-tag input to workflow_call and workflow_dispatch
- Remove dry-run input and all associated steps
- Remove skip-cache input (no longer relevant)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

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

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: 82fb20dd32

ℹ️ 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".

artifact="goose-${target}.zip"
gh release download "${TAG}" --pattern "${artifact}" --dir /tmp
unzip -o "/tmp/${artifact}" -d /tmp/goose-extract
cp /tmp/goose-extract/goose.exe "${pkg_dir}/goose.exe"
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 Copy Windows binary from extracted goose-package directory

The Windows branch copies /tmp/goose-extract/goose.exe, but in the checked release pipeline (.github/workflows/build-cli.yml), the zip is created with 7z ... goose-package/, so extraction places the executable at .../goose-package/goose.exe. On any run that includes win32-x64, this cp path is missing and the release job fails before pnpm publish, blocking npm publication.

Useful? React with 👍 / 👎.

Sync all @aaif/* package versions past the 0.13.0 currently
published on npm. Remove stale initial-release changeset.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jamadeo jamadeo requested a review from alexhancock April 9, 2026 21:26
Copy link
Copy Markdown

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

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: 5ae724689c

ℹ️ 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".

artifact="goose-${target}.zip"
gh release download "${TAG}" --pattern "${artifact}" --dir /tmp
unzip -o "/tmp/${artifact}" -d /tmp/goose-extract
cp /tmp/goose-extract/goose.exe "${pkg_dir}/goose.exe"
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 Copy Windows executable from extracted package folder

The Windows download path assumes the zip extracts goose.exe at the root, but this commit’s release artifacts are packaged with a goose-package/ directory. Fresh evidence: .github/workflows/build-cli.yml creates the zip via 7z ... goose-package/, so after unzip the executable is at .../goose-package/goose.exe; this cp path fails for win32-x64, aborting npm publication.

Useful? React with 👍 / 👎.

type: string
workflow_dispatch:
inputs:
dry-run:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

worth keeping dry-run perhaps, or no in your view?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I'll add it back. Removed because the whole job set the environment anyway, but we can change this so the publish part is its own job so the whole thing is testable without publish and without the environment constraint

Copy link
Copy Markdown

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

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: 46fcd85ca5

ℹ️ 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".

Comment on lines +183 to +186
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: npm-packages
path: ui/
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 Preserve executable bits for goose binaries across jobs

Uploading the entire ui/ tree as an artifact here introduces a permissions regression for Unix binaries: actions/upload-artifact/download-artifact does not preserve executable mode, so bin/goose can be republished as non-executable after the build→publish handoff. That makes installed @aaif/goose-binary-* packages fail at runtime when @aaif/goose tries to spawn the resolved binary path (ui/text/src/tui.tsx), typically with EACCES on macOS/Linux. Re-applying chmod +x before pnpm publish (or artifacting a tarball that preserves modes) avoids shipping broken binaries.

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.

2 participants