Skip to content

Commit ba811e7

Browse files
committed
added bump
1 parent b9ce635 commit ba811e7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

scripts/bump.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
version=$(git describe --tags --abbrev=0 | sed 's/^v//')
6+
IFS='.' read -r major minor patch <<EOF
7+
$version
8+
EOF
9+
10+
case "$1" in
11+
major) major=$((major + 1)); minor=0; patch=0 ;;
12+
minor) minor=$((minor + 1)); patch=0 ;;
13+
patch) patch=$((patch + 1)) ;;
14+
*) echo "Usage: $0 {major|minor|patch}"; exit 1 ;;
15+
esac
16+
17+
new_tag="v$major.$minor.$patch"
18+
git commit --allow-empty -m "chore: bump version to $new_tag"
19+
git tag "$new_tag"
20+
git push origin HEAD "$new_tag"
21+
echo "Bumped to $new_tag"

0 commit comments

Comments
 (0)