From ed65b5b2d17f871ade4d9704aab7a8f3da638ace Mon Sep 17 00:00:00 2001 From: kerem-acer Date: Tue, 30 Jun 2026 13:15:53 +0300 Subject: [PATCH] ci: derive publish version from release.tag_name, fail fast if empty 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) --- .github/workflows/publish.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 189a79e..bc5e1af 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,7 +16,18 @@ jobs: - name: Extract version from tag id: version - run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT + # Use the release payload's tag_name, not GITHUB_REF_NAME: when a release + # is published from a draft, GITHUB_REF_NAME does not resolve to the tag and + # comes back empty, which silently writes empty `version` fields and breaks + # `bun publish` ("name and version fields must be non-empty strings"). + run: | + VERSION="${{ github.event.release.tag_name }}" + VERSION="${VERSION#v}" + if [ -z "$VERSION" ]; then + echo "::error::Could not determine version from release tag '${{ github.event.release.tag_name }}'" + exit 1 + fi + echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" - name: Update package versions run: |