File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Version Bump
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ jobs :
8+ bump-version :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - uses : actions/checkout@v4
12+ with :
13+ fetch-depth : 0
14+
15+ - name : Set up Git
16+ run : |
17+ git config --global user.name "github-actions"
18+ git config --global user.email "github-actions@github.com"
19+
20+ - name : Bump version if needed
21+ run : bash scripts/bump-version.sh
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ plugins {
55}
66
77group = ' com.blockcloud'
8- version = ' 0.0.1-SNAPSHOT'
8+
9+ def props = new Properties ()
10+ file(" version.properties" ). withInputStream { props. load(it) }
11+ version = props[' version' ]
912
1013java {
1114 toolchain {
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -e
3+
4+ version=$( grep ' version=' version.properties | cut -d' =' -f2)
5+ IFS=' .' read -r major minor patch <<< " $version"
6+
7+ if git log -1 --pretty=%B | grep -q " ^feat:" ; then
8+ minor=$(( minor + 1 ))
9+ patch=0
10+ elif git log -1 --pretty=%B | grep -q " ^fix:" ; then
11+ patch=$(( patch + 1 ))
12+ else
13+ echo " No version bump needed."
14+ exit 0
15+ fi
16+
17+ new_version=" $major .$minor .$patch "
18+ echo " Bumping version to $new_version "
19+
20+ echo " version=$new_version " > version.properties
21+
22+ git config user.name " github-actions"
23+ git config user.email " github-actions@github.com"
24+ git commit -am " chore: bump version to $new_version "
25+ git tag " v$new_version "
26+ git push origin HEAD --tags
Original file line number Diff line number Diff line change 1+ version =0.1.0
You can’t perform that action at this time.
0 commit comments