Skip to content

Publish the version in package.json with the organization's npm token - #13

Draft
jwrosewell wants to merge 2 commits into
rcfrom
ci/publish-the-package-version
Draft

jwrosewell wants to merge 2 commits into
rcfrom
ci/publish-the-package-version

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 18, 2026 •

Copy link
Copy Markdown

What this does

Makes the Publish package workflow able to publish the version in package.json, so that @51degrees/ua-parser-js 2.0.4 can reach npm. npm still serves 2.0.3 of 17 February 2023, with the README of that time, while main and rc are at 2.0.4 with the README from #5.

Four changes to .github/workflows/main.yml, and nothing else.

  1. The npm token. The workflow published with the repository secret NPM_TOKEN, last set on 17 February 2023. npm says "As of November 2025, only Granular access tokens are supported" and "Legacy access tokens have been removed" (About access tokens). It now uses the organization secret NPM_AUTH_TOKEN, which the other 51Degrees npm packages publish with, most recently fiftyone.devicedetection 4.5.102 on 4 November 2026.
  2. No version input. The version input, whose default was 2.0.0, ran yarn version and pushed a commit and a tag. The workflow now publishes the version package.json holds, so only a reviewed commit can change it. yarn publish --non-interactive keeps that version rather than asking for one.
  3. Tag after publishing. The tag v<version> is now pushed after npm accepts the version, rather than before, so a failed publish leaves no tag behind.
  4. The runner's Node.js. The pin to Node.js 16 is gone, so the build and tests run on the runner's Node.js, as run-test.yml does, whose last run on rc passed 94 of 94 tests with yarn 1.22.22. actions/checkout and actions/setup-node move from v2 to v4.

Before running it

  1. Merge this into rc, then rc into main (the last rc into main was Release candidate #7 on 4 November).
  2. Check that the organization secret NPM_AUTH_TOKEN is available to this repository. Reading which repositories an organization secret reaches needs an organization admin, so this was not checked.
  3. Run Publish package from main. It publishes 2.0.4 and tags v2.0.4. No tag v2.0.4 exists today.

How it was checked

  • yarn 1's version command keeps the current version when it runs non-interactively, read from src/cli/commands/version.js on the master branch.
  • The workflow was not run, because a run publishes. The tests it runs are the ones run-test.yml runs on every push.

Outstanding

npm says "The ability to publish new package versions directly with a granular access token will be removed in January 2027", and recommends trusted publishing for CI (About access tokens). This workflow, like every 51Degrees npm publish, uses a token, so it needs moving to trusted publishing before then.

@jwrosewell jwrosewell changed the title Publish the version in package.json with the organisation's npm token Publish the version in package.json with the organization's npm token Nov 18, 2026

This branch has not been deployed

No deployments
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