Skip to content

Commit 73a0c4f

Browse files
committed
Set version specifiers automatically in release script [skip ci]
1 parent 8bb5e46 commit 73a0c4f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/autorelease.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ cd mfix
2121
# gather version list
2222
readarray -t all_versions < <(git ls-remote --heads origin | awk '{print $2}' | sed 's:.*/::' | sort -V)
2323

24+
last_released_version=""
2425
do_release() {
2526
echo "will now make release for $1"
2627
git checkout $1 &>/dev/null || git checkout -b $1 &>/dev/null
27-
echo "we think the current tag is $(git describe --tags --abbrev=0)"
28+
current_tag=$(git describe --tags --abbrev=0)
29+
echo "we think the current tag is $current_tag"
2830
echo "the current commit head is $(git rev-parse HEAD)"
29-
read -p "new tag name: " tag_name
31+
old_version_specifier=$(echo $current_tag | awk -F+ '{print $2}')
32+
read -e -p "new tag name (${old_version_specifier}): " -i "${last_released_version}" tag_name
33+
if [[ $tag_name != *"+"* ]]; then
34+
tag_name=${tag_name}+${old_version_specifier}
35+
fi
36+
last_released_version=$(echo $tag_name | awk -F+ '{print $1}')
3037
git tag -a $tag_name -m "$tag_name"
3138
git push --tags
3239
gh release create $tag_name --target $1 --title "$tag_name" --notes ""

0 commit comments

Comments
 (0)