Files
prplMesh/release.sh
Frederik Van Bogaert b5511b5b6a Prepare release 4.2.0
Signed-off-by: Frederik Van Bogaert <frederik.vanbogaert@mind.be>
2023-11-22 21:33:34 +01:00

39 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
if [ "$#" != 1 ] ; then
echo "Usage: ./release.sh <release_version>"
exit 1
fi
VERSION="$1"
VERSION_FILE="cmake/multiap-helpers.cmake"
if [[ ! "$VERSION" =~ [0-9]+.[0-9]+.[0-9]+ ]] ; then
echo "The release version must follow semantic versioning."
exit 1
fi
sed -ri "s/prplmesh_VERSION \"[0-9]+\.[0-9]+\.[0-9]+\"/prplmesh_VERSION \"$VERSION\"/g" cmake/multiap-helpers.cmake
# The gen_changelog.py script relies on the tag to exist to be able to
# generate the changelog. However, we need to include the new
# changelog in the version that we tag, which leaves us with a
# chicken-and-egg problem. To work around it, create a first tag only
# for gen_changelog.py to use, then move the tag once the new
# changelog has been commited. Note that because of this, the release
# date gen_changelog.py will use at the next invocation will not be
# the same as the one stored in the CHANGELOG.md file (as the tag will
# have been moved a few seconds later).
git tag -a "$VERSION" -m "prplMesh release $VERSION"
tools/gen_changelog.py -U > CHANGELOG.md
git add "$VERSION_FILE"
git add CHANGELOG.md
git commit -s -m "Prepare release $VERSION"
# Move the tag to our final commit:
git tag -a -f "$VERSION" -m "prplMesh release $VERSION"
echo "The release has been created, check the result before pushing it."