Skip to content

fix(versionfile): keep hyphens in a prerelease suffix - #345

Merged
ValentinLutz merged 1 commit into
monkescience:mainfrom
nateships:fix/versionfile-prerelease-hyphen
Nov 2, 2026
Merged

ValentinLutz merged 1 commit into
monkescience:mainfrom
nateships:fix/versionfile-prerelease-hyphen

Conversation

@nateships

Copy link
Copy Markdown
Contributor

Split from #335 (commit 10).

What

yeet now replaces the full old version in an x-yeet-version marker when the prerelease suffix has a hyphen.

Before this fix, yeet stopped at the first hyphen in the suffix. It left the rest of the old suffix in the file:

Line before New version Before the fix After the fix
VERSION = "1.2.3-rc-1" 1.2.4 VERSION = "1.2.4-1" VERSION = "1.2.4"
VERSION = "1.2.3-rc.1" 1.2.4 VERSION = "1.2.4" VERSION = "1.2.4"

Why

SemVer allows hyphens in a prerelease suffix. The pattern for build metadata already accepts hyphens. This change makes the prerelease pattern do the same.

Impact

  • User-visible: version files with a hyphen in the prerelease suffix now update correctly. On main, only semver targets make prereleases.
  • Security: none.

Tests

A new test in internal/versionfile/generic_test.go covers this case. The test fails without the fix.

The version pattern stopped a prerelease suffix at the first hyphen. A marker with 1.2.3-rc-1 or a calver label such as 2026.11.1-public-beta became 1.2.4-1 or 2026.11.2-public-beta-beta. The suffix now accepts hyphens, as the build metadata already did.
@ValentinLutz
ValentinLutz merged commit 1ef2743 into monkescience:main Nov 2, 2026
13 checks passed
@monkescience-yeet monkescience-yeet Bot mentioned this pull request Nov 2, 2026
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.

2 participants