Skip to content

fix(release): build before publish, tag versions already on npm - #1

Merged
Makisuo merged 2 commits into
mainfrom
fix/release-bin-and-tag
Nov 2, 2026
Merged

Makisuo merged 2 commits into
mainfrom
fix/release-bin-and-tag

Conversation

@Makisuo

@Makisuo Makisuo commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the failing Release run (https://github.com/MapleTechLabs/changesets/actions/runs/41433533590).

What failed: ENEEDAUTH on npm publish. The package did not exist on npm yet, and trusted publishing (OIDC) cannot do a package's first publish. 0.1.0 has since been published by hand, so that part is unblocked once the trusted publisher is configured for this repo and release.yml.

Fixed here:

  • npm publish dropped bin (script name dist/bin.mjs was invalid and removed) because it checks bin before prepublishOnly builds dist/. The workflow now builds first. Without this, a CI publish would ship a package with no changeset command.
  • scripts/publish.ts returned early when the version was already on npm, so 0.1.0 never got a tag or GitHub release. It now tags whenever the remote tag is missing.
  • Tags are lightweight, so they no longer carry the test-fixture git identity (Fixture <fixture@example.com>, 2026-01-01) from the shared run helper.

Verified locally: typecheck and build pass. npm pack --dry-run keeps dist/bin.mjs with no bin warning. Running scripts/publish.ts reports 0.1.0 as already on npm, creates the @maple-dev/changesets@0.1.0 tag and writes the git-tag line to CHANGESETS_OUTPUT.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Chores
    • Updated the release process to build the package before publishing and to check both publication and tag status.
    • Releases now stop when the version is already tagged, while eligible untagged versions can be tagged. Unexpected tag-check failures are reported as release errors.

…ady on npm

npm publish validated bin before prepublishOnly built dist/, so CI would
publish a tarball without the changeset command. The publish script also
skipped tagging any version already on npm, so the hand-published 0.1.0
never got a tag or GitHub release. Tags are lightweight now so they do not
carry the test-fixture git identity.
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1db7552c-4d87-46b3-9123-2dffa6e69d6d
Commits

Reviewing files that changed from the base of the PR and between 3a2991d and 7944a78.

Files selected for processing: 1
  • scripts/publish.ts
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 65466bcd-da12-481d-bddc-3bdb3cac0361
Commits

Reviewing files that changed from the base of the PR and between 6e8b563 and 3a2991d.

Files selected for processing: 2
  • .github/workflows/release.yml
  • scripts/publish.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The release workflow builds the package before running Changesets. The publish script checks npm publication and remote Git tag state. It stops when the tag exists, creates a tag when the remote lookup exits with code 2, and returns a ReleaseError for other lookup failures.

Changes: Release Flow

Layer / File(s) Summary
Build before Changesets
.github/workflows/release.yml
The release workflow runs bun run build after dependency installation and before the Changesets action.
Publication and remote tag checks
scripts/publish.ts
When npm already has the version, the script continues to check the remote tag. It stops if the tag exists, creates a tag when the lookup exits with code 2, and returns a ReleaseError for other lookup failures.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Low · previous review 3a299

Some releases may need manual reporting or tag cleanup, but these failures are limited to specific release states.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes both main changes: building before publishing and tagging versions that already exist on npm.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread scripts/publish.ts Resolved
Comment thread scripts/publish.ts Resolved
@Makisuo
Makisuo merged commit 19bf9b5 into main Nov 2, 2026
2 checks passed
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