Skip to content

ci: publish Sentinel through npm Trusted Publishing - #29

Merged
myProjectsRavi merged 2 commits into
mainfrom
agent/npm-trusted-publishing
Aug 16, 2026
Merged

myProjectsRavi merged 2 commits into
mainfrom
agent/npm-trusted-publishing

Conversation

@myProjectsRavi

Copy link
Copy Markdown
Owner

Goal

Match Sentinel's npm authentication model to the safer Nipun-style Trusted Publishing/OIDC path and remove the long-lived NPM_TOKEN dependency that blocked automatic synchronization.

Current evidence

The first automatic release-sync run on main correctly detected sentinel-protocol@1.2.8 was missing, then failed at the npm credential preflight because NPM_TOKEN is not configured. It stopped before creating v1.2.8, so GitHub and npm remain consistent.

Changes

  • Use Node 22.14.0 and npm 11.5.1 for the Trusted Publishing client requirement.
  • Remove NPM_TOKEN from the release workflow.
  • Publish through GitHub Actions OIDC (id-token: write) with npm publish --access public.
  • Verify any existing tag identity before publishing, but do not create a missing tag until npm publication succeeds.
  • Keep exact-main CI + adversarial-security-scan requirements and all release-specific runtime/performance/package gates.
  • Make recovery idempotent: if npm is already on the intended version, a rerun can finish GitHub tag/Release synchronization instead of publishing twice.
  • Document the exact npm Trusted Publisher fields in UPDATING.md.

Required one-time npm package setting before merge

Configure the sentinel-protocol package Trusted Publisher on npmjs.com:

  • GitHub Actions
  • Organization/user: myProjectsRavi
  • Repository: sentinel-protocol
  • Workflow filename: release.yml
  • Environment: unset
  • Allowed action: npm publish

Safety

  • No production runtime/security-engine code changes.
  • No production dependency changes.
  • Existing release tags are never moved.
  • A failed npm publish cannot create a new GitHub-only tag/release.

@myProjectsRavi
myProjectsRavi marked this pull request as ready for review August 16, 2026 18:41
@myProjectsRavi
myProjectsRavi merged commit 62612c5 into main Aug 16, 2026
30 of 31 checks passed

@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: d8b4383c3c

ℹ️ 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 74 to +76
if [[ "${published}" == "${VERSION}" ]]; then
if [[ "${latest}" != "${VERSION}" ]]; then
echo "${PACKAGE_NAME}@${VERSION} already exists, but latest points to ${latest:-missing}; refusing to guess at dist-tag repair." >&2
exit 1
fi
echo "${PACKAGE_NAME}@${VERSION} is already published and latest. Nothing to synchronize."
echo "release=false" >> "${GITHUB_OUTPUT}"
exit 0
echo "npm already contains ${PACKAGE_NAME}@${VERSION}; GitHub release synchronization will still be verified/repaired."
echo "publish_needed=false" >> "${GITHUB_OUTPUT}"

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 Restore the no-op after a completed release

When a version was published and tagged at commit A, any later green main commit B that does not bump package.json now sets release=true. In the Verify existing release tag identity step, the immutable tag still points to A while RELEASE_SHA is B, so the workflow exits with an error. Consequently, every ordinary post-release commit produces a failed release-sync run instead of the documented fast no-op; retain the no-op when npm and the existing GitHub release are already synchronized.

Useful? React with 👍 / 👎.

Comment on lines 74 to 81
if [[ "${published}" == "${VERSION}" ]]; then
if [[ "${latest}" != "${VERSION}" ]]; then
echo "${PACKAGE_NAME}@${VERSION} already exists, but latest points to ${latest:-missing}; refusing to guess at dist-tag repair." >&2
exit 1
fi
echo "${PACKAGE_NAME}@${VERSION} is already published and latest. Nothing to synchronize."
echo "release=false" >> "${GITHUB_OUTPUT}"
exit 0
echo "npm already contains ${PACKAGE_NAME}@${VERSION}; GitHub release synchronization will still be verified/repaired."
echo "publish_needed=false" >> "${GITHUB_OUTPUT}"
else
echo "publish_needed=true" >> "${GITHUB_OUTPUT}"
fi

echo "release=true" >> "${GITHUB_OUTPUT}"

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 Verify provenance before tagging an existing npm version

If publication succeeds at commit A but the job stops before creating the GitHub tag, and commit B subsequently reaches main without a version bump, this branch treats the npm version as recoverable while retaining B as RELEASE_SHA. Because no tag exists, the later release step creates v<version> at B even though the immutable npm artifact was built from A, misrepresenting the package's source. Recovery must determine and verify the published artifact's original commit rather than assuming the current main SHA.

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