breakhack/build/scripts/release_patch_version.sh

25 lines
896 B
Bash
Raw Normal View History

2018-05-17 08:59:13 +02:00
#!/bin/sh
# Get the current patch version
MAJOR_VERSION=$(egrep -o 'breakhack_MAJOR_VERSION [0-9]+' CMakeLists.txt | awk '{print $2}')
MINOR_VERSION=$(egrep -o 'breakhack_MINOR_VERSION [0-9]+' CMakeLists.txt | awk '{print $2}')
LAST_PATCH_VERSION=$(egrep -o 'breakhack_PATCH_VERSION [0-9]+' CMakeLists.txt | awk '{print $2}')
2018-09-25 14:26:50 +02:00
NEXT_PATCH_VERSION=$((LAST_PATCH_VERSION + 1))
2018-05-17 08:59:13 +02:00
LAST_TAG=v$MAJOR_VERSION.$MINOR_VERSION.$LAST_PATCH_VERSION
NEXT_TAG=v$MAJOR_VERSION.$MINOR_VERSION.$NEXT_PATCH_VERSION
2018-05-17 10:06:58 +02:00
2018-05-17 09:49:03 +02:00
# Update the version and create release notes
2018-05-17 08:59:13 +02:00
sed -i -e "s/breakhack_PATCH_VERSION [0-9]\+/breakhack_PATCH_VERSION $NEXT_VERSION/" CMakeLists.txt
git log --oneline $LAST_TAG..HEAD > build/releasenotes/$NEXT_TAG.txt
2018-05-17 10:06:58 +02:00
git add build/releasenotes/$NEXT_TAG.txt
2018-05-17 08:59:13 +02:00
git commit -a -m"Patch version raised to $NEXT_VERSION"
2018-05-17 09:49:03 +02:00
2018-05-17 10:06:58 +02:00
# Create the tag
git tag $NEXT_TAG
2018-05-17 09:58:18 +02:00
# Push to repo
git push
2018-05-17 10:06:58 +02:00
git push origin $NEXT_TAG
2018-05-17 09:49:03 +02:00