Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions tag_and_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
# Script to release a new version of the forwarder service
# It does this by creating a branch named after the version, updating
# version.py, committing those changes to the branch
#
# Usage:
# tag_and_release.sh version
# The version should be the semantic version for this new release

if [ $# -ne 1 ]; then
echo "Usage tag_and_release version"
exit 1
fi

VERSION=$1

SEMVER_REGEX="^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"

if [[ ! $VERSION =~ $SEMVER_REGEX ]]; then
echo "Version should be a nice Semantic Version String (https://semver.org)"
exit 1
fi

verify_version() {
FUNCX_VERSION=$(python3 -c "import funcx_websocket_service.version; print(funcx_websocket_service.version.VERSION)")

if [[ $FUNCX_VERSION == "$VERSION" ]]
then
echo "Version requested matches package version: $VERSION"
else
echo "Updating version.py to match release"
sed "s/^VERSION *= *'.*'/VERSION = '$VERSION'/" funcx_forwarder/version.py > funcx_forwarder/version.py.bak
mv funcx_forwarder/version.py.bak funcx_forwarder/version.py
fi
}


create_release_branch () {
echo "Creating branch"
git checkout -b "v$VERSION"
git add funcx_forwarder/version.py
git commit -m "Update to version $VERSION"

echo "Pushing branch"
git push origin "v$VERSION"
}


verify_version
create_release_branch