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: |