ci: fix publish failing with empty version on draft releases - #80
Merged
Conversation
When a release is published from a draft, GITHUB_REF_NAME does not resolve
to the tag and comes back empty. The "Update package versions" step then ran
`jq '.version = ""'`, writing empty version fields into every package.json.
build/test don't validate version, so the failure only surfaced at
`bun publish` ("name and version fields must be non-empty strings"), as in
the v0.1.41 release run.
Read the version from the canonical github.event.release.tag_name instead,
and fail the job immediately if it resolves empty so we never publish
corrupt manifests silently again.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The v0.1.41 publish run failed at the Publish packages step:
Root cause
The v0.1.41 release was created as a draft (2026-06-25) and published later (2026-06-30). For releases published from a draft,
GITHUB_REF_NAMEdoes not resolve to the tag — it came back empty.The
Extract version from tagstep (echo "VERSION=${GITHUB_REF_NAME#v}") therefore produced an emptyVERSION. The next step ranjq '.version = ""'and wrote an emptyversioninto all six publishedpackage.jsonfiles.bun build/bun testdon't validateversion, so the failure only surfaced atbun publish.v0.1.40 succeeded because it was published directly (the tag existed), so
GITHUB_REF_NAMEwas set.Confirmed in the logs:
Run VERSION=0.1.40Run VERSION=(empty)Fix
github.event.release.tag_name, which is populated forreleaseevents regardless of draft origin.Follow-up
The
v0.1.41tag predates this fix, so re-running the failed job would still use the old workflow. To actually ship the unpublished0.1.41packages, cut a fresh release (e.g.v0.1.42) frommainafter this merges.🤖 Generated with Claude Code