Skip to content

Read a version from a tag that carries no v - #2

Merged
marcobambini merged 1 commit into
mainfrom
fix-bare-version-tags
Nov 16, 2026
Merged

marcobambini merged 1 commit into
mainfrom
fix-bare-version-tags

Conversation

@marcobambini

Copy link
Copy Markdown
Member

Get version strips refs/tags/v from GITHUB_REF in one go:

echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT

That assumes every caller tags v1.4.3. sqliteai/sqlite-js tags with the bare version its
Makefile reports — its tags are 1.4.0, 1.4.1, 1.4.2, 1.4.3 — and for refs/tags/1.4.3 the
prefix refs/tags/v does not match, so nothing is removed. VERSION becomes the whole
refs/tags/1.4.3, and the format check in Extract User-Facing Changelog and Generate JSON
rejects it:

❌ ERROR: Invalid version format 'refs/tags/1.4.3'. Expected format: X.Y.Z

refs/tags/ now comes off first and a leading v after it, so both conventions read as 1.4.3.

Why nobody had hit it

sqlite-js's caller listened for v*.*.* tags, which its tags never matched either, so this
workflow had run exactly once in its life — by hand, on 2026-07-21. I fixed that pattern in
sqliteai/sqlite-js#35 earlier today, which means the next tag there would have started this
workflow and failed it right here. So that fix needs this one to be any use.

Checked

GITHUB_REF before after
refs/tags/1.4.3 refs/tags/1.4.3 ❌ 1.4.3 ✅
refs/tags/v1.4.3 1.4.3 ✅ 1.4.3 ✅
refs/tags/2.0.10 refs/tags/2.0.10 ❌ 2.0.10 ✅

All three pass the ^[0-9]+\.[0-9]+\.[0-9]+$ check afterwards, and the YAML parses. Callers that
tag with a v get exactly what they got before
, so this is not a behaviour change for anyone
already working.

Two things that fall out of the same step

  • The URL output carried no version. It reads $VERSION as a shell variable, but the old
    code only ever wrote VERSION= into $GITHUB_OUTPUT, so the variable was never set and the URL
    ended at releases/tag/ with nothing after it — visible in a real run as
    🔗 Release: https://github.com/sqliteai/sqlite-js/releases/tag/. The issue-closing comment
    links to that URL. Assigning VERSION in the shell, which the fix above needs anyway, sets it.
  • test_version now arrives through the env instead of being interpolated straight into the
    script, since the value is whatever the person running the dispatch typed.

What this does not change, on purpose

Create GitHub Release still builds tag_name: v${{ steps.get_version.outputs.VERSION }}. For a
caller that tags with a v that is right, and unchanged; for a bare-tag caller it would produce
v1.4.3 where the tag is 1.4.3. It did not come up here because sqlite-js passes
create_release: false, and changing it would alter what existing callers publish, so it seemed
better left to you than bundled in.

After merging

Callers pin @v1, and v1 currently points at 3e48ffe, the tip of main. The tag has to move
to the merge commit before anyone picks this up.

🤖 Generated with Claude Code

Get version stripped "refs/tags/v" from GITHUB_REF in one go, which assumes
every caller tags v1.4.3. sqlite-js tags with the bare version its Makefile
reports, 1.4.3, and for such a tag the prefix does not match, so nothing was
removed: VERSION became the whole refs/tags/1.4.3 and the format check in
"Extract User-Facing Changelog and Generate JSON" rejected it.

refs/tags/ now comes off first and a leading v after it, so 1.4.3 and v1.4.3
both read as 1.4.3. Callers that tag with a v get exactly what they got
before.

This was invisible until now because sqlite-js's own workflow listened for
"v*.*.*" tags, which its tags never matched either, so the workflow had run
once in its life, by hand. With that pattern fixed the next tag would have
started this workflow and failed it here.

Two things fall out of the same step:

- VERSION is a shell variable now, so the URL output carries the version. It
  was read as a shell variable already, but only ever written to
  $GITHUB_OUTPUT, so the URL ended at releases/tag/ with nothing after it and
  the issue-closing comment linked to it.
- test_version arrives through the env instead of being interpolated into the
  script, since the value belongs to whoever runs the dispatch.

Checked against refs/tags/1.4.3, refs/tags/v1.4.3 and refs/tags/2.0.10: all
three give the bare version and pass the format check. The YAML parses.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@marcobambini
marcobambini merged commit a2567ae into main Nov 16, 2026
@marcobambini
marcobambini deleted the fix-bare-version-tags branch November 16, 2026 09:16
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