Skip to content

fix(ci): sync platform package versions + force local-path publish#55

Merged
27Bslash6 merged 3 commits into
mainfrom
ci/fix-platform-publish-bugs
May 17, 2026
Merged

fix(ci): sync platform package versions + force local-path publish#55
27Bslash6 merged 3 commits into
mainfrom
ci/fix-platform-publish-bugs

Conversation

@27Bslash6
Copy link
Copy Markdown
Contributor

@27Bslash6 27Bslash6 commented May 17, 2026

Summary

Two latent bugs in `build-native.yml`'s publish job, caught during the local 0.1.2 bootstrap publish. Neither would have allowed a successful release-please-driven publish even with a working `NPM_TOKEN` — the publish job has never actually run end-to-end.

Bug 1: missing `napi version` (platform packages stuck at scaffolded version)

napi-rs scaffolds `npm//package.json` files at the version present when `napi build` first ran (here: 0.1.0). They don't update on subsequent version bumps unless explicitly synced.

Without this step, every release would have published the platform packages at `0.1.0` forever, even as the parent package bumped to 0.1.2, 0.1.3, etc. The main `@cachekit-io/cachekit-core-ts` package would then fail to install because its `optionalDependencies` request a matching version that wouldn't exist.

Fix: `npx napi version` between `napi artifacts` and the publish loop. It reads the parent package's version and writes it into each `npm//package.json`.

Bug 2: `find ... npm publish {}` interpreted as GitHub shorthand

`npm publish npm/darwin-arm64` is interpreted as the GitHub shorthand `/`, not a local directory. npm tries `ssh://git@github.com/npm/darwin-arm64.git`, fails with `Permission denied (publickey)` because GHA runners have no SSH key for github.com.

Visible in run 25986564957 which fired on the `cachekit-core-ts-v0.1.2` tag push.

Fix: prefix `{}` with `./` to force local-directory interpretation.

Why now

Surfaced during the local-publish bootstrap script (`/tmp/publish-cachekit-0.1.2.sh`). Both bugs reproduced locally; both fixes were validated in the script. The same fixes here mean future CI-driven releases work as intended.

Interaction with #50

#50 (OIDC trusted publishing, draft) also touches the publish steps in this workflow — replacing `NODE_AUTH_TOKEN` with OIDC. When #50 is ready to come out of draft, it'll rebase onto this fix and keep both improvements.

Test plan

  • `actionlint` clean
  • Both fixes validated locally during the 0.1.2 publish script run (the napi version step bumped all 5 platform jsons to 0.1.2; the `./` prefix avoided the GitHub shorthand interpretation)
  • Next `cachekit-core-ts-v*` tag push exercises the full publish job end-to-end (requires ci: switch npm publish to OIDC trusted publishing (removes NPM_TOKEN) #50 + trusted publishers to land before `NPM_TOKEN` can be retired, but this PR's fixes work with either auth model)

Summary by CodeRabbit

  • Chores
    • Improved automated publishing workflow to sync per-platform package versions with the main package before publishing.
    • Switched to publishing platform packages via explicit local package paths for more reliable releases.
    • Adjusted preparation and publish steps and clarified flags/behavior to reduce release inconsistencies and better document expected outcomes.

Review Change Stack

Two bugs in the build-native.yml publish job that have been latent
since the workflow was first written. Caught both during the local
0.1.2 bootstrap publish — neither would have allowed a successful
release-please-driven publish even with a working NPM_TOKEN.

1. Missing `napi version`

   napi-rs scaffolds npm/<platform>/package.json files at the version
   present when `napi build` first ran (here: 0.1.0). The version
   field stays at that scaffolded value on every subsequent release
   unless explicitly synced. Without this step, platform packages
   would publish at 0.1.0 forever even as the parent package bumped.

   Fix: add `npx napi version` between `napi artifacts` and the
   publish loop. It reads the parent package's version and writes
   it into each npm/<platform>/package.json.

2. `find ... npm publish {}` path interpretation

   `npm publish npm/darwin-arm64` is interpreted as the GitHub
   shorthand <user>/<repo>, not a local directory. npm tries
   ssh://git@github.com/npm/darwin-arm64.git, fails with
   "Permission denied (publickey)" because GHA runners have no
   SSH key for github.com. Failure visible in run 25986564957.

   Fix: prefix with `./` to force directory interpretation.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cb3a6ffd-2920-4b98-816a-77240d525140

📥 Commits

Reviewing files that changed from the base of the PR and between e34c508 and fd6c815.

📒 Files selected for processing (1)
  • .github/workflows/build-native.yml

📝 Walkthrough

Walkthrough

The publish job now runs npx napi version to sync per-platform npm/*/package.json versions, publishes each platform package using npm publish ./<dir> (local-path), and changes the main prepublish invocation to npx napi prepublish -t npm --no-gh-release.

Changes

Platform Package Publishing

Layer / File(s) Summary
Version sync and platform package publishing
.github/workflows/build-native.yml
Adds a step to run npx napi version to sync per-platform package versions and updates the publish loop to list npm/*/ and run npm publish ./{} to force local-directory interpretation; preserves --access public and --provenance and uses NODE_AUTH_TOKEN.
Main package prepublish invocation
.github/workflows/build-native.yml
Replaces npx napi prepublish -t npm --skip-gh-release with npx napi prepublish -t npm --no-gh-release and documents the CLI flag behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through YAML, nose a-twitch,
Bumped platform versions without a hitch,
Local paths now lead each package's way,
Prepublish says "no GH release" today,
Tiny paws pushed publish — hip hooray!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely summarizes the two main bug fixes: syncing platform package versions and forcing local-path publish interpretation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@napi-rs/cli v3 removed --skip-gh-release entirely. The new default
behavior is "do not create a GitHub release"; opt in with --gh-release
if you want one (we don't — release-please.yml owns GH release
creation for both packages via its own action).

Caught locally during the 0.1.2 bootstrap publish, same surface as
the other two fixes in this PR.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/build-native.yml:
- Around line 196-198: The CI step changed the napi prepublish invocation and
unintentionally enables GitHub releases; update the run command that calls "npx
napi prepublish -t npm" to explicitly disable releases by adding the
"--no-gh-release" flag (or, if releases are intended, update the comment to
state that "--gh-release" defaults to true); specifically modify the "npx napi
prepublish -t npm" invocation to "npx napi prepublish -t npm --no-gh-release"
(and remove or correct references to the removed "--skip-gh-release" flag) so
behavior matches the comment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 88c8aee3-84a1-480e-90ea-0e6ae048916e

📥 Commits

Reviewing files that changed from the base of the PR and between 9f9205b and e34c508.

📒 Files selected for processing (1)
  • .github/workflows/build-native.yml

Comment thread .github/workflows/build-native.yml Outdated
Addresses PR review feedback. Previously relied on the v3 default of
"no GH release" being implicit. The explicit --no-gh-release flag
(clipanion-auto-generated negation of --gh-release) makes intent
unambiguous so a future default flip in napi-rs can't change behavior
silently.

Verified the flag is accepted: dry-run exits 0 with --no-gh-release,
whereas an invented flag errors with Unsupported option name. The
flag doesn't appear in the --help output (clipanion only lists the
positive form) but is functional.
@27Bslash6 27Bslash6 merged commit ba8518c into main May 17, 2026
14 checks passed
@27Bslash6 27Bslash6 deleted the ci/fix-platform-publish-bugs branch May 17, 2026 11:57
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