Skip to content

ci(nodejs): skip npm publish when the version is already published - #608

Merged
hogan-yuan merged 1 commit into
mainfrom
ci/npm-skip-published
Oct 15, 2026
Merged

hogan-yuan merged 1 commit into
mainfrom
ci/npm-skip-published

Conversation

@hogan-yuan

Copy link
Copy Markdown
Member

Problem

Re-running the Release workflow on a version that is already on npm fails publish-nodejs-sdk. npm refuses to publish over an existing version, so every package fails with:

npm error 403 Forbidden - PUT https://registry.npmjs.org/longbridge-win32-x64-msvc
You cannot publish over the previously published versions: 5.2.1.

This happened in the v5.2.1 Maven Central retry (run 38549442368, job 115844279153). The npm packages were already complete from the first run. The other publishers already guard against this case: Maven Central and crates.io check the published version first, and PyPI uses skip-existing. npm was the only one without a guard.

Fix

Add a Check if version already on npm step that sets NPM_EXISTS, and gate Publish on it, mirroring the Maven Central step.

  • Which package is checked: only the main longbridge package. It is published last, after every platform package, so if it exists, the whole set exists.
  • How existence is detected: the step tests whether npm view printed anything, not its exit code. Older npm versions exit 0 with empty output for a missing version.

Verification

  • release.yml parses as valid YAML.
  • I ran the step's script locally against a package.json with each version:
    • 5.2.1 → already on npm; skipping publish → NPM_EXISTS=true
    • 9.9.9 → not found on npm; will publish → NPM_EXISTS=false
  • nodejs/package.json gets the release version from the existing Update versions step (update_jssdk_version.mjs), which runs before the check.

CI-only change; no CHANGELOG entry.

🤖 Generated with Claude Code

npm refuses to publish over an existing version, so re-running the
Release workflow (e.g. to retry another SDK's publish, as with the
v5.2.1 Maven Central retry) failed publish-nodejs-sdk with E403 for
every package. Check the main package version first, like the existing
Maven Central / crates.io / PyPI guards, and skip the publish when it is
already on npm. The main package is published last, so its presence
means every platform package is published too.
@hogan-yuan
hogan-yuan merged commit 579f368 into main Oct 15, 2026
56 checks passed
@hogan-yuan
hogan-yuan deleted the ci/npm-skip-published branch October 15, 2026 05:38
@hogan-yuan hogan-yuan mentioned this pull request Oct 16, 2026
hogan-yuan added a commit that referenced this pull request Oct 16, 2026
Release **v5.2.2**. Bumps workspace `5.2.1` → `5.2.2`.

### New since v5.2.1
- **Added:** attached (take-profit / stop-loss) orders gain bid/ask
depth levels (longbridge/developers#1189). `SubmitAttachedParams` /
`ReplaceAttachedParams` gain `profit_taker_depth_level` /
`stop_loss_depth_level` (int32, valid when `activate_order_type` is
`LIT`), and `AttachedOrderDetail` gains `limit_depth_level`. Across
Rust, C, C++, Java, Node.js and Python (the Go SDK ships separately,
openapi-go#132) (#607)

### Release pipeline (no SDK changes)
- Java: bump `central-publishing-maven-plugin` to 0.12.0 so Maven
Central accepts bundles built with Maven 3.10 (#606)
- Node.js: skip npm publish when the version is already published, so
re-running the Release workflow no longer fails with E403 (#608)
- Lower the Linux gnu glibc baseline for the Node.js & Python SDKs
(#609)

Only `Cargo.toml` (workspace version + internal dep reqs) and
`CHANGELOG.md` change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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