Skip to content

ci: manual npm release workflow with OIDC trusted publishing - #7

Merged
NathanWalker merged 1 commit into
mainfrom
ci/npm-oidc-release
Nov 24, 2026
Merged

NathanWalker merged 1 commit into
mainfrom
ci/npm-oidc-release

Conversation

@NathanWalker

Copy link
Copy Markdown
Contributor

Summary

Adds .github/workflows/secure_nx_release.yml, a manual (workflow_dispatch) release for @nativescript/tanstack-router, modeled on NativeScript/NativeScript's secure_nx_release.yml. It publishes to npm with OIDC trusted publishing and provenance, so no local npm publish or long-lived token is needed.

Flow

  1. nx release <bump> bumps packages/tanstack-router/package.json, writes the CHANGELOG entry, and commits and tags {version}-tanstack-router. All of this stays local.
  2. nx build and nx test. Nothing is pushed until both pass.
  3. git push --atomic --follow-tags.
  4. nx release publish from dist/packages/tanstack-router with OIDC (any lingering token auth is cleared first).
  5. A GitHub release is created from the version's CHANGELOG section.

Inputs

Input Use
version Exact version (e.g. 0.3.0-rc.0). The npm dist-tag is derived from it.
release-type patch / minor / major → latest; prerelease → preid tag. Default is patch.
preid Prerelease id and dist-tag (default next).
publish-only Publish the version already committed in package.json, keeping its hand-written CHANGELOG entry. It refuses a version npm already has, tags HEAD, publishes, and creates the GitHub release.
dry-run Runs every step with no push, no publish and no GitHub release.

Differences from the NativeScript workflow: there are no push or tag triggers (manual only), it covers a single project, it runs tests, and it has the publish-only mode.

Config changes

  • project.json: nx-release-publish now publishes from dist/packages/{projectName}. It previously defaulted to the source folder.
  • nx.json: release.version.generatorOptions.updateDependents: "never". Otherwise versioning also bumps apps/demo-solid, and the changelog step fails because that project has no tags.

Local checks: actionlint is clean. nx release patch --dry-run produces the bump, changelog, commit and tag. nx release publish --dry-run packs from dist.

One-time setup before the first run

  1. npm → @nativescript/tanstack-router → Settings → Trusted Publisher → GitHub Actions: org NativeScript, repo tanstack, workflow secure_nx_release.yml, environment npm-publish.
  2. GitHub → Settings → Environments: create npm-publish (optionally restricted to main), plus npm-publish-dry-run if dry runs should be gated like in NativeScript/NativeScript. If they don't exist, GitHub creates them unprotected on first run.
  3. (Optional fallback) To use a token instead of OIDC, set the USE_NPM_TOKEN=true variable and the NPM_PUBLISH_TOKEN secret.

Releasing 0.2.2

After this PR and #6 (which carries release: 0.2.2 and its CHANGELOG) are merged: Actions → Release Workflow → Run workflow on main with publish-only checked. Running once with dry-run checked first is a good smoke test.

Adds a workflow_dispatch release, modeled on NativeScript/NativeScript's
secure_nx_release.yml: nx release bumps the version, writes the changelog,
commits and tags; the package is built and tested, then published to npm
with OIDC trusted publishing and provenance, and a GitHub release is
created from the CHANGELOG entry.

- publish-only input publishes the version already committed in
  package.json (with its hand-written CHANGELOG entry) and tags it.
- Nothing is pushed until build and tests pass.
- Gated by the npm-publish / npm-publish-dry-run environments; the
  NPM_PUBLISH_TOKEN fallback is used only when USE_NPM_TOKEN=true.
- nx-release-publish publishes from dist/packages/tanstack-router, and
  versioning no longer bumps dependents (the demo app).
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5d3a4895-86e1-42e5-9aea-fc5e842b367c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@NathanWalker
NathanWalker merged commit ffc772c into main Nov 24, 2026
4 checks passed
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