Skip to content

Publish on merge to main and move dist-tags through OIDC - #24

Merged
thisnick merged 1 commit into
mainfrom
ci/publish-on-main
Dec 3, 2026
Merged

thisnick merged 1 commit into
mainfrom
ci/publish-on-main

Conversation

@thisnick

@thisnick thisnick commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Releases now follow the Wechaty convention: merge a pull request that bumps the version, and CI publishes. Dist-tags can be moved without an npm token.

Changes

  • Publish on merge. A push to main publishes when package.json has a version that isn't on npm yet. It then creates the v<version> tag and a GitHub release with notes generated from the merged pull requests; a next release is marked as a prerelease. Pushing a tag no longer publishes, and a commit whose version is already on npm publishes nothing. The publish job gets contents: write for the tag and release.
  • Move a dist-tag. A manual run (gh workflow run ci.yml -f version=0.1.3 -f tag=latest, or the Actions tab) points a dist-tag at a published version through npm trusted publishing. npm has supported OIDC for npm dist-tag since npm 12.2.0 / 11.21.0, when the trusted publisher has Allow npm dist-tag enabled, which it does. The job checks that the version is on npm and accepts only plain version and tag names. The build is skipped for these runs.
  • README: how to release and how to move a dist-tag.

Before merging

The npm environment only allows v* tags today. Both jobs now run from main, so add main under Settings → Environments → npm → Deployment branches and tags.

After merging

Run gh workflow run ci.yml -f version=0.1.3 -f tag=latest to move latest off 0.1.1, which can't be installed alongside wechaty@next. The merge itself publishes nothing, because 0.1.3 is already on npm.

Testing

  • Checked the workflow YAML and job conditions.
  • Checked npm view wechaty-puppet-neo@<version> version with npm 12.2.3: it prints 0.1.3 for a published version and nothing for 0.1.9. The step runs the check inside [ … ], so bash -e doesn't stop on the failed lookup.
  • Checked the input validation against good and bad values: 0.1.3/latest and 0.1.3-rc.1/next pass; 1.2, Latest, and values containing ; are rejected.

🤖 Generated with Claude Code

- A push to main publishes when package.json has a version that isn't on
  npm yet, then creates the v<version> tag and a GitHub release with
  generated notes (a prerelease for next). Pushing tags no longer
  publishes, and a commit whose version is already on npm publishes
  nothing.
- A manual run (workflow_dispatch with version and tag) points a dist-tag
  at a published version with npm trusted publishing, which npm supports
  for dist-tags since npm 12.2.0 when the trusted publisher allows it. The
  build is skipped for these runs.
- README: how to release and how to move a dist-tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thisnick
thisnick merged commit bbb5a07 into main Dec 3, 2026
7 checks passed
@thisnick
thisnick deleted the ci/publish-on-main branch December 3, 2026 03:54
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