Skip to content

Commit 561fe79

Browse files
committed
test: added test for skip-prerelease flag
1 parent b1bd0f4 commit 561fe79

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ You can configure the action with various inputs, a list of which has been provi
187187
| tool-version | The version of the tool to run | latest |
188188
| release-branch | The name of the master/main branch | master |
189189
| dev-branch | The name of the development branch | dev |
190+
| skip-prerelease | Skip prerelease part of the version. When true, release-branch and dev-branch are effectively ignored | false |
190191
| minor-identifier | The string used to identify a minor release (wrap with '/' to match using a regular expression) | feature: |
191192
| major-identifier | The string used to identify a major release (wrap with '/' to match using a regular expression) | breaking: |
192193
| prefix | The prefix used for the version name | |

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ inputs:
1818
required: true
1919
default: dev
2020
skip-prerelease:
21-
description: "Avoid prerelease part of the version. When true, release-branch and dev-branch are ignored"
21+
description: "Skip prerelease part of the version. When true, release-branch and dev-branch are effectively ignored"
2222
required: true
2323
default: "false"
2424
minor-identifier:

spec/git-version-spec.cr

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,30 @@ describe GitVersion do
7171
end
7272
end
7373

74+
it "should skip prerelease component in the version number when configured" do
75+
tmp = InTmp.new
76+
77+
begin
78+
tmp.exec %(git init)
79+
tmp.exec %(git checkout -b master)
80+
tmp.exec %(git commit --no-gpg-sign --allow-empty -m "1")
81+
tmp.exec %(git tag "1.0.0")
82+
83+
tmp.exec %(git checkout -b my-fancy.branch)
84+
tmp.exec %(git commit --no-gpg-sign --allow-empty -m "2")
85+
86+
git = GitVersion::Git.new("dev", "master", "feature:", "breaking:", tmp.@tmpdir, "", "", true)
87+
88+
hash = git.current_commit_hash
89+
90+
version = git.get_new_version
91+
92+
version.should eq("1.0.1")
93+
ensure
94+
tmp.cleanup
95+
end
96+
end
97+
7498
it "should properly bump the version" do
7599
tmp = InTmp.new
76100

0 commit comments

Comments
 (0)