Update release-move-tag.sh

Fixes commit counting logic, some typos and logs more info.
This commit is contained in:
Jonas Zaugg committed 2021-01-05 14:42:40 +01:00
1 parent 1b5e938423
commit 602ac871b8
1 file changed
+7 -4
+7 -4
View File
@@ -4,10 +4,10 @@ set -e
# Convenience script to automatically commit Package.swift after updating the checksum and move the latest tag
latest_git_tag=$(git describe --abbrev=0) # gets the latest tag name
commits_since_tag=$(git rev-list ${latest_git_tag}.. --count)
if [ "$commits_since_tag" -ge 1 ]; then
# If there has been more than one commits since the latest tag, it's highly likely that we did not intend to do a full release
echo "WARNING: More than one commit ($commits_since_tag) since tag '$latest_git_tag'. Did you tag a new version?"
echo "Package.swift has not been commited and tag has not been moved."
if [ "$commits_since_tag" -gt 0 ]; then
# If there have been commits since the latest tag, it's highly likely that we did not intend to do a full release
echo "WARNING: $commits_since_tag commit(s) since tag '$latest_git_tag'. Did you tag a new version?"
echo "Package.swift has not been committed and tag has not been moved."
else
# TODO: add sanity check to see if version is actually being updated or not?
read -p "Do you want to commit changes to Package.swift and force move tag '$latest_git_tag'? (required for Swift Package Manager release) " -n 1 -r
@@ -19,5 +19,8 @@ else
git add Package.swift
git commit -m "Update Package.swift"
git tag -fa $latest_git_tag -m "${long_message}"
echo "Package.swift committed and tag '$latest_git_tag' moved."
else
echo "Package.swift has not been committed and tag has not been moved."
fi
fi