From 0f3d946e6606f4eb6e0dbc9dafacc496c406d508 Mon Sep 17 00:00:00 2001 From: Ben Galewsky Date: Wed, 11 Aug 2021 16:11:06 -0500 Subject: [PATCH 1/2] Add script to tag and release a new version of web service --- tag_and_release.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 tag_and_release.sh diff --git a/tag_and_release.sh b/tag_and_release.sh new file mode 100755 index 0000000..277dcc6 --- /dev/null +++ b/tag_and_release.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Script to release a new version of the web 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 + +verify_version() { + FUNCX_VERSION=$(python3 -c "import funcx_web_service.version; print(funcx_web_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_web_service/version.py > funcx_web_service/version.py.bak + mv funcx_web_service/version.py.bak funcx_web_service/version.py + git status + fi +} + + +create_release_branch () { + echo "Creating branch" + git checkout -b "$VERSION" + git add funcx_web_service/version.py + git commit -m "Update to version $VERSION" + + echo "Pushing branch" + git push origin "$VERSION" +} + + +verify_version +create_release_branch + From 12761c63b131283d49421ef56a598c3b2054486b Mon Sep 17 00:00:00 2001 From: Ben Galewsky Date: Thu, 12 Aug 2021 10:34:16 -0500 Subject: [PATCH 2/2] Make sure tag_and_release accepts correct SemVers and then adds v to branch --- tag_and_release.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tag_and_release.sh b/tag_and_release.sh index 277dcc6..5562afb 100755 --- a/tag_and_release.sh +++ b/tag_and_release.sh @@ -14,6 +14,13 @@ 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_web_service.version; print(funcx_web_service.version.VERSION)") @@ -31,12 +38,12 @@ verify_version() { create_release_branch () { echo "Creating branch" - git checkout -b "$VERSION" + git checkout -b "v$VERSION" git add funcx_web_service/version.py git commit -m "Update to version $VERSION" echo "Pushing branch" - git push origin "$VERSION" + git push origin "v$VERSION" }