2021-11-30 10:27:05 +00:00
|
|
|
#!/bin/bash
|
2021-09-29 08:53:44 +00:00
|
|
|
CURRENT_BRANCH=`git branch --show-current`
|
2021-11-16 11:01:54 +00:00
|
|
|
if [[ $CURRENT_BRANCH != "master" ]]; then
|
|
|
|
echo "Not on master branch"
|
2021-11-30 10:27:05 +00:00
|
|
|
exit 1
|
2021-09-29 08:53:44 +00:00
|
|
|
fi
|
2021-12-03 14:31:19 +00:00
|
|
|
VERSION=$1
|
|
|
|
if [[ -z $VERSION ]]; then
|
|
|
|
echo "Must provide version"
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-09-29 08:53:44 +00:00
|
|
|
|
2021-10-04 20:59:08 +00:00
|
|
|
DATE=`date "+%Y-%m-%d"`
|
2022-09-23 21:05:21 +00:00
|
|
|
CHANGELOG_GLOB="CHANGELOG.md"
|
2021-11-30 09:00:07 +00:00
|
|
|
COMMIT_MESSAGE="[ci skip] Set release date"
|
2021-11-16 11:01:54 +00:00
|
|
|
TAG_MESSAGE="Release"
|
2021-11-30 10:27:05 +00:00
|
|
|
sed -i'' -E "s/^.*Unreleased.*$/## $VERSION ($DATE)/" $CHANGELOG_GLOB
|
2021-10-06 11:22:45 +00:00
|
|
|
|
2021-11-16 11:01:54 +00:00
|
|
|
if ! git commit -am "$COMMIT_MESSAGE"; then
|
2021-10-06 11:22:45 +00:00
|
|
|
echo "Failed to commit release"
|
|
|
|
git reset --hard
|
2021-11-30 10:27:05 +00:00
|
|
|
exit 1
|
2021-10-06 11:22:45 +00:00
|
|
|
fi
|
|
|
|
|
2021-11-30 10:27:05 +00:00
|
|
|
if ! git tag -a "v$VERSION" -m "$TAG_MESSAGE"; then
|
2021-10-06 11:22:45 +00:00
|
|
|
echo "Failed to tag release"
|
|
|
|
git reset --hard HEAD^
|
2021-11-30 10:27:05 +00:00
|
|
|
exit 1
|
2021-10-06 11:22:45 +00:00
|
|
|
fi
|