Skip to content

Commit

Permalink
create release script (#8)
Browse files Browse the repository at this point in the history
* Updated gitHeadLocal.gin

* add create-release.sh script #7

* Updated gitHeadLocal.gin
  • Loading branch information
prudhomm authored Aug 4, 2024
1 parent 1d06676 commit 5c46f49
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 9 deletions.
18 changes: 9 additions & 9 deletions gitHeadLocal.gin
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
\usepackage[%
shash={e65c9e2},
lhash={e65c9e2f7454b5c49de946e2a8eceedebca803cd},
shash={3400099},
lhash={3400099fa7e9bf11823012d44c68c4277fc1cd2f},
authname={Christophe Prud'homme},
authemail={[email protected]},
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={[email protected]},
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}
44 changes: 44 additions & 0 deletions release
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5c46f49

Please sign in to comment.