Release/1.0 #1

Merged
k3nny merged 19 commits from release/1.0 into main 2026-07-11 22:11:21 +02:00
5 changed files with 16 additions and 16 deletions
Showing only changes of commit 16b25da396 - Show all commits
+1 -1
View File
@@ -83,7 +83,7 @@ releaser --branch-pattern "^(?:.*/)?(?:release|hotfix)/(\d+)\.(\d+)$"
```yaml ```yaml
git: git:
tag_prefix: "v" # set to "" for tags without prefix tag_prefix: "" # default: no prefix; set to "v" for v-prefixed tags
branch_pattern: "^(?:.*/)?release/(\\d+)\\.(\\d+)$" # two capture groups: major, minor branch_pattern: "^(?:.*/)?release/(\\d+)\\.(\\d+)$" # two capture groups: major, minor
commit_message: "chore(release): {version} [skip ci]" commit_message: "chore(release): {version} [skip ci]"
author_name: "" # defaults to git config user.name author_name: "" # defaults to git config user.name
+1 -1
View File
@@ -27,7 +27,7 @@ const defaultConfigTemplate = `# .releaser.yml — configuration for git.k3nny.f
# CLI flags always take precedence over values set here. # CLI flags always take precedence over values set here.
git: git:
# Prefix prepended to every version tag. # Prefix prepended to every version tag (default: no prefix).
# tag_prefix: "v" # tag_prefix: "v"
# Regex that identifies release branches. Must contain exactly two capture # Regex that identifies release branches. Must contain exactly two capture
+11 -11
View File
@@ -228,9 +228,9 @@ func TestRunMissingPom(t *testing.T) {
// Tag must still have been created. // Tag must still have been created.
repo2, _ := gogit.PlainOpen(dir) repo2, _ := gogit.PlainOpen(dir)
_, err = repo2.Tag("v1.2.0") _, err = repo2.Tag("1.2.0")
if err != nil { if err != nil {
t.Error("expected tag v1.2.0 to be created") t.Error("expected tag 1.2.0 to be created")
} }
} }
@@ -250,9 +250,9 @@ func TestRunNoPomAtDefaultPath(t *testing.T) {
} }
repo2, _ := gogit.PlainOpen(dir) repo2, _ := gogit.PlainOpen(dir)
_, err = repo2.Tag("v2.0.0") _, err = repo2.Tag("2.0.0")
if err != nil { if err != nil {
t.Error("expected tag v2.0.0 to be created") t.Error("expected tag 2.0.0 to be created")
} }
} }
@@ -366,12 +366,12 @@ func TestRunDuplicateTag(t *testing.T) {
w.Add("x.go") w.Add("x.go")
w.Commit("fix: patch something", &gogit.CommitOptions{Author: testSig()}) w.Commit("fix: patch something", &gogit.CommitOptions{Author: testSig()})
// Pre-create a v1.2.0 ref pointing to a garbage hash. // Pre-create a 1.2.0 ref pointing to a garbage hash.
// LatestTag skips it (resolveTagToCommit fails for garbage hash), // LatestTag skips it (resolveTagToCommit fails for garbage hash),
// so run() calculates "v1.2.0" as the first-ever version — then // so run() calculates "1.2.0" as the first-ever version — then
// CreateTag("v1.2.0") fails because the ref already exists. // CreateTag("1.2.0") fails because the ref already exists.
fakeRef := plumbing.NewHashReference( fakeRef := plumbing.NewHashReference(
plumbing.NewTagReferenceName("v1.2.0"), plumbing.NewTagReferenceName("1.2.0"),
plumbing.NewHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), plumbing.NewHash("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"),
) )
if err := repo.Storer.SetReference(fakeRef); err != nil { if err := repo.Storer.SetReference(fakeRef); err != nil {
@@ -380,7 +380,7 @@ func TestRunDuplicateTag(t *testing.T) {
err := execCmd(t, "--tag-only", "--no-push", "--branch", "release/1.2", "--repo", dir) err := execCmd(t, "--tag-only", "--no-push", "--branch", "release/1.2", "--repo", dir)
if err == nil { if err == nil {
t.Fatal("expected error: v1.2.0 ref already exists") t.Fatal("expected error: 1.2.0 ref already exists")
} }
} }
@@ -431,9 +431,9 @@ func TestRunGitLabError(t *testing.T) {
func TestRunWithPreviousTag(t *testing.T) { func TestRunWithPreviousTag(t *testing.T) {
repo, dir := setupRepo(t) repo, dir := setupRepo(t)
// Tag the initial commit as v1.2.0 (simulates a prior release) // Tag the initial commit as 1.2.0 (simulates a prior release)
initialHead, _ := repo.Head() initialHead, _ := repo.Head()
repo.CreateTag("v1.2.0", initialHead.Hash(), nil) repo.CreateTag("1.2.0", initialHead.Hash(), nil)
// Fix commit after the tag — run() will use CommitsSince, not AllCommits // Fix commit after the tag — run() will use CommitsSince, not AllCommits
addFile(t, dir, "x.go", "// fix") addFile(t, dir, "x.go", "// fix")
+1 -1
View File
@@ -40,7 +40,7 @@ type GitLabConfig struct {
func defaults() Config { func defaults() Config {
return Config{ return Config{
Git: GitConfig{ Git: GitConfig{
TagPrefix: "v", TagPrefix: "",
BranchPattern: branch.DefaultBranchPattern, BranchPattern: branch.DefaultBranchPattern,
CommitMessage: "chore(release): {version} [skip ci]", CommitMessage: "chore(release): {version} [skip ci]",
}, },
+2 -2
View File
@@ -11,8 +11,8 @@ func TestLoadDefaults(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if cfg.Git.TagPrefix != "v" { if cfg.Git.TagPrefix != "" {
t.Errorf("TagPrefix = %q, want %q", cfg.Git.TagPrefix, "v") t.Errorf("TagPrefix = %q, want %q", cfg.Git.TagPrefix, "")
} }
if cfg.Maven.PomPath != "pom.xml" { if cfg.Maven.PomPath != "pom.xml" {
t.Errorf("PomPath = %q, want %q", cfg.Maven.PomPath, "pom.xml") t.Errorf("PomPath = %q, want %q", cfg.Maven.PomPath, "pom.xml")