Skip to content

Commit d839ab4

Browse files
committed
script to tag releases
1 parent d6d5bb7 commit d839ab4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tag-version.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
if [ $# -ne 1 ]; then
5+
echo "Usage: $0 <version> (e.g. 0.1.0 or v0.1.0)"
6+
exit 1
7+
fi
8+
9+
# Strip everything except digits and dots, so inputs like 'v0.1.0'
10+
# or 'release-1.2' become '0.1.0' and '1.2' respectively.
11+
RAW_VERSION="$1"
12+
VERSION="$(printf '%s' "$RAW_VERSION" | tr -cd '0-9.')"
13+
14+
if [ -z "$VERSION" ]; then
15+
echo "Error: could not extract numeric version from '$RAW_VERSION'"
16+
exit 1
17+
fi
18+
19+
# 1) Make sure main is up to date
20+
git checkout main
21+
git pull
22+
23+
# 2) Create an annotated tag
24+
git tag -a "v$VERSION" -m "cbm-basic v$VERSION"
25+
26+
# 3) Push main and the tag to GitHub
27+
git push
28+
git push origin "v$VERSION"
29+
30+
# 4) GitHub Actions workflow will build artifacts and create a Release for v$VERSION

0 commit comments

Comments
 (0)