ci(sdk): publish the JavaScript SDK to npm via trusted publishing - #1085
Merged
Conversation
@rmyndharis/openwa was the only SDK with no release automation at all: 0.1.0 reached npm from a laptop in June and nothing has published it since. Add a tag-triggered workflow, modelled on java-sdk-release.yml. Authentication is npm Trusted Publishing (OIDC), so no npm token exists in the workflow or in repository secrets — npm mints a short-lived credential from the GitHub OIDC token and attaches build provenance automatically. That also keeps this path clear of npm's token programme: classic tokens were revoked in December 2025, granular write tokens are capped at 90 days, and 2FA-bypass tokens lose direct publish in January 2027. A trusted publisher is the migration target rather than a casualty. Requires npm >= 11.5.1, which is newer than the npm bundled with Node 22, so the workflow upgrades the CLI before publishing rather than failing with a misleading missing-token error. Guards mirror the Java release: workflow_dispatch is restricted to the same tag shape a push triggers on, and the tag version must match package.json. Both are textual and run before anything is built or published. The publish runs the SDK's own test, typecheck, build and dual CJS/ESM smoke gates first, so the tarball that reaches npm is the one those gates passed. The npmjs.com trusted-publisher entry is a one-time manual step and is documented in sdk/javascript/README.md -> Releasing.
rmyndharis
force-pushed
the
feat/js-sdk-trusted-publishing
branch
from
August 6, 2026 02:53
ed0e3e9 to
933a611
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@rmyndharis/openwawas the only SDK with no release automation at all. Version 0.1.0 reached npm from a laptop in June and nothing has published it since, which is why it still reads 0.1.0 while the Java SDK — the one with a release workflow — is on 0.1.1.Change
A tag-triggered publish workflow modelled on
java-sdk-release.yml, using npm Trusted Publishing (OIDC).There is no npm token in the workflow or in repository secrets. npm mints a short-lived credential from the GitHub OIDC token and attaches build provenance automatically, so nothing long-lived exists to leak or rotate. That also keeps this path out of npm's token programme rather than subject to it: classic tokens were revoked in December 2025, granular write tokens are now capped at 90 days, and 2FA-bypass tokens lose direct publish in January 2027. Trusted publishing is the stated migration target for all three.
Details worth noting for review:
--provenanceflag. npm attaches provenance on its own for a trusted-publisher release; passing it would be redundant.workflow_dispatchis restricted to the samejs-sdk-v*tag shape a push triggers on, so an arbitrary branch or a monorepov*app tag cannot reach npm, and the tag version must matchpackage.json. Both are textual, matching the Java release's approach.One-time setup required before the first tag
The npmjs.com side cannot be automated. On the package settings for
@rmyndharis/openwa, add a Trusted Publisher: GitHub Actions, organizationrmyndharis, repositoryOpenWA, workflow filenamejs-sdk-release.yml. Until that exists npm rejects the publish. Documented insdk/javascript/README.md-> Releasing.No repository secrets are needed.
Note on the other SDKs
For context, the current state across all five: Java publishes to Maven Central on a
java-sdk-v*tag and is at 0.1.1; PHP is mirrored to its own repository on every push tomain; Python is on PyPI at 0.1.0 with no workflow (still manual); Go needs no publish step but has no semantic version tag, so consumers resolve a pseudo-version. Only the JavaScript gap is addressed here.