Skip to content

fix: guard release tarball rename against same-file mv#22

Merged
narthur merged 1 commit into
masterfrom
fix/release-pack-samefile
Jul 15, 2026
Merged

fix: guard release tarball rename against same-file mv#22
narthur merged 1 commit into
masterfrom
fix/release-pack-samefile

Conversation

@narthur

@narthur narthur commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

What

Guard the mv in the release workflow's pack step so it doesn't try to move the tarball onto itself.

Why it failed

Third time's the charm. The last run got all the way through semver-bootstrap, install, build, and pack — then died on:

mv: 'expost-1.0.0.tgz' and 'expost-1.0.0.tgz' are the same file

pnpm pack names the tarball from package.json's version (1.0.0), and the release tag resolved to v1.0.0, so the rename-to-tag mv had identical source and dest → error → no release.

Fix

Only rename when the packed name and the tag-derived name actually differ (they diverge once tags advance past the static package.json version):

src=$(ls expost-*.tgz)
dest="expost-${VERSION#v}.tgz"
[ "$src" = "$dest" ] || mv "$src" "$dest"

Verified both branches locally (same-name → skip; 1.0.0 pack + v1.1.0 tag → renames to expost-1.1.0.tgz).

Result

Merging cuts v1.0.0 with expost-1.0.0.tgz attached (every prior step already passed on the last run), unblocking beeminder/blog#762.

🤖 Generated with Claude Code

When package.json's version equals the release tag (e.g. both 1.0.0),
pnpm pack already produces expost-1.0.0.tgz and the rename-to-tag mv
targets the same filename, which errors and fails the release. Guard
the mv so it only runs when the names actually differ.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@narthur
narthur merged commit 671131b into master Jul 15, 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