From 5c46f4963c24c3bf9373ba4aeda14343764c8f9b Mon Sep 17 00:00:00 2001 From: Christophe Prud'homme Date: Sun, 4 Aug 2024 23:23:25 +0200 Subject: [PATCH] create release script (#8) * Updated gitHeadLocal.gin * add create-release.sh script #7 * Updated gitHeadLocal.gin --- gitHeadLocal.gin | 18 +++++++++--------- release | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 9 deletions(-) create mode 100755 release diff --git a/gitHeadLocal.gin b/gitHeadLocal.gin index 6ec6031d..6fa59d03 100644 --- a/gitHeadLocal.gin +++ b/gitHeadLocal.gin @@ -1,17 +1,17 @@ \usepackage[% - shash={e65c9e2}, - lhash={e65c9e2f7454b5c49de946e2a8eceedebca803cd}, + shash={3400099}, + lhash={3400099fa7e9bf11823012d44c68c4277fc1cd2f}, authname={Christophe Prud'homme}, authemail={christophe.prudhomme@cemosis.fr}, authsdate={2024-08-04}, - authidate={2024-08-04 17:03:16 +0200}, - authudate={1722783796}, + authidate={2024-08-04 23:21:20 +0200}, + authudate={1722806480}, commname={Christophe Prud'homme}, commemail={christophe.prudhomme@cemosis.fr}, commsdate={2024-08-04}, - commidate={2024-08-04 17:03:16 +0200}, - commudate={1722783796}, - refnames={ (HEAD -> main, tag: v1.1.1, tag: v1.1.0, origin/main, origin/HEAD)}, - firsttagdescribe={v1.1.0}, - reltag={v1.1.0-0-ge65c9e2} + commidate={2024-08-04 23:21:20 +0200}, + commudate={1722806480}, + refnames={ (HEAD -> 7-add-create-releasesh-script)}, + firsttagdescribe={v1.1.0-3-g3400099}, + reltag={v1.1.0-3-g3400099} ]{gitexinfo} \ No newline at end of file diff --git a/release b/release new file mode 100755 index 00000000..1c993390 --- /dev/null +++ b/release @@ -0,0 +1,44 @@ +#!/bin/bash + +# Exit immediately if a command exits with a non-zero status +set -e + +# Function to create a release +create_release() { + VERSION=$1 + + if [ -z "$VERSION" ]; then + echo "Usage: $0 create vx.y.z" + exit 1 + fi + + # Tag the repository with the provided version + git tag -a "$VERSION" -m "Release $VERSION" + + # Checkout the tag to trigger post-commit hook to update gitinfo2 info file + git checkout + + # Push the changes and the tags + git push origin main --follow-tags + + echo "Release $VERSION created and pushed successfully." +} + +# Function to list releases +list_releases() { + git tag +} + +# Main script logic +case "$1" in + create) + create_release "$2" + ;; + list) + list_releases + ;; + *) + echo "Usage: $0 {create|list} [version]" + exit 1 + ;; +esac \ No newline at end of file