Update action to support with tag_prefix parameter

This commit is contained in:
Sefa Şentürk
2024-08-30 11:05:23 +02:00
parent c1faa9d742
commit 56f4a516dd
6 changed files with 100 additions and 7 deletions

View File

@@ -409,3 +409,24 @@ function init_repo {
[[ "$output" = *"VERSION=1.2.4"* ]]
[[ "$output" = *"No conventional commit found"* ]]
}
@test "increments the patch version by default if no conventional commits found and enabled (conventional commits) (with tag_prefix)" {
init_repo
export tag_prefix="@org/product"
export current_version="@org/product@1.2.3"
export scheme="conventional_commits"
echo "some new change" > feat.txt
git add feat.txt
git commit -m "new change"
run ../../version-increment.sh
print_run_info
[ "$status" -eq 0 ] &&
[[ "$output" = *"VERSION=@org/product@1.2.4"* ]]
[[ "$output" = *"V_VERSION=@org/product@v1.2.4"* ]]
[[ "$output" = *"No conventional commit found"* ]]
}

View File

@@ -72,6 +72,37 @@ function init_repo {
[[ "$output" = *"CURRENT_V_VERSION=v0.1.2"* ]]
}
@test "finds the current normal version with tag_prefix enabled" {
init_repo
export tag_prefix="@org/product"
git tag @org/product@0.0.1
git tag @org/product@0.1.1
git tag @org/product@0.1.2
run version-lookup.sh
print_run_info
[ "$status" -eq 0 ] &&
[[ "$output" = *"CURRENT_VERSION=0.1.2"* ]]
}
@test "tag_prefix enabled prefixes with a v" {
init_repo
export tag_prefix="@org/product"
git tag @org/product@0.1.2
run version-lookup.sh
print_run_info
[ "$status" -eq 0 ] &&
[[ "$output" = *"CURRENT_VERSION=0.1.2"* ]] &&
[[ "$output" = *"CURRENT_V_VERSION=v0.1.2"* ]]
}
@test "finds the current normal version even if there's a newer pre-release version" {
init_repo