Skip to content

Commit 2d5ee6a

Browse files
committed
Add bin/releaseit
1 parent f219d0c commit 2d5ee6a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

bin/releaseit

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
eval "$(pkgx --shellcode)"; env +yq
3+
set -euo pipefail
4+
5+
INCREMENT=${1:-PATCH}
6+
7+
increment_version() {
8+
local version=$1
9+
local part=$2
10+
IFS='.' read -ra VERSION_PARTS <<< "$version"
11+
case "$part" in
12+
MAJOR)
13+
VERSION_PARTS[0]=$((VERSION_PARTS[0]+1))
14+
VERSION_PARTS[1]=0
15+
VERSION_PARTS[2]=0
16+
;;
17+
MINOR)
18+
VERSION_PARTS[1]=$((VERSION_PARTS[1]+1))
19+
VERSION_PARTS[2]=0
20+
;;
21+
PATCH)
22+
VERSION_PARTS[2]=$((VERSION_PARTS[2]+1))
23+
;;
24+
esac
25+
echo "${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${VERSION_PARTS[2]}"
26+
}
27+
28+
current_version=$(yq e '.env.VERSION' .pkgx.yaml)
29+
new_version=$(increment_version $current_version $INCREMENT)
30+
yq e -i ".env.VERSION = \"$new_version\"" .pkgx.yaml
31+
git add .pkgx.yaml
32+
git commit -m "Release v$new_version"
33+
echo "Release v$new_version committed."

0 commit comments

Comments
 (0)