feat: default to release-version file
Some checks failed
Action Validation / validate-released-binary (amd64, ./vociferate, X64) (push) Failing after 6s
Action Validation / validate-released-binary (arm64, qemu-aarch64-static ./vociferate, ARM64) (push) Failing after 23s
Push Validation / validate (push) Successful in 52s

This commit is contained in:
Micheal Wilkinson
2026-03-20 19:32:49 +00:00
parent a413385c4e
commit 2646d42523
7 changed files with 21 additions and 21 deletions

View File

@@ -1,3 +0,0 @@
package version
const String = "1.0.0"

View File

@@ -10,8 +10,8 @@ import (
)
const (
defaultVersionFile = "internal/vociferate/version/version.go"
defaultVersionExpr = `const String = "([^"]+)"`
defaultVersionFile = "release-version"
defaultVersionExpr = `^\s*([^\r\n]+)\s*$`
defaultChangelog = "changelog.md"
)

View File

@@ -21,12 +21,9 @@ func TestPrepareSuite(t *testing.T) {
func (s *PrepareSuite) SetupTest() {
s.rootDir = s.T().TempDir()
versionDir := filepath.Join(s.rootDir, "internal", "vociferate", "version")
require.NoError(s.T(), os.MkdirAll(versionDir, 0o755))
require.NoError(s.T(), os.WriteFile(
filepath.Join(versionDir, "version.go"),
[]byte("package version\n\nconst String = \"1.1.6\"\n"),
filepath.Join(s.rootDir, "release-version"),
[]byte("1.1.6\n"),
0o644,
))
@@ -42,9 +39,9 @@ func (s *PrepareSuite) TestPrepare_UpdatesVersionAndPromotesUnreleasedNotes() {
require.NoError(s.T(), err)
versionBytes, err := os.ReadFile(filepath.Join(s.rootDir, "internal", "vociferate", "version", "version.go"))
versionBytes, err := os.ReadFile(filepath.Join(s.rootDir, "release-version"))
require.NoError(s.T(), err)
require.Equal(s.T(), "package version\n\nconst String = \"1.1.7\"\n", string(versionBytes))
require.Equal(s.T(), "1.1.7\n", string(versionBytes))
changelogBytes, err := os.ReadFile(filepath.Join(s.rootDir, "changelog.md"))
require.NoError(s.T(), err)
@@ -144,8 +141,8 @@ func (s *PrepareSuite) TestPrepare_UsesCustomVersionFileAndPattern() {
func (s *PrepareSuite) TestPrepare_AllowsUnchangedVersionValue() {
require.NoError(s.T(), os.WriteFile(
filepath.Join(s.rootDir, "internal", "vociferate", "version", "version.go"),
[]byte("package version\n\nconst String = \"1.1.6\"\n"),
filepath.Join(s.rootDir, "release-version"),
[]byte("1.1.6\n"),
0o644,
))
@@ -153,9 +150,9 @@ func (s *PrepareSuite) TestPrepare_AllowsUnchangedVersionValue() {
require.NoError(s.T(), err)
versionBytes, readErr := os.ReadFile(filepath.Join(s.rootDir, "internal", "vociferate", "version", "version.go"))
versionBytes, readErr := os.ReadFile(filepath.Join(s.rootDir, "release-version"))
require.NoError(s.T(), readErr)
require.Equal(s.T(), "package version\n\nconst String = \"1.1.6\"\n", string(versionBytes))
require.Equal(s.T(), "1.1.6\n", string(versionBytes))
}
func (s *PrepareSuite) TestRecommendedTag_UsesCustomVersionFileAndPattern() {