Using cut to increment version
Some checks failed
sample gradle build and test / build (pull_request) Successful in 1m22s
sample gradle build and test / build (push) Failing after 18s

This commit is contained in:
hitanshu310 2025-06-05 21:45:30 +05:30
parent 1cd63d6d3d
commit 005863c998

View File

@ -18,14 +18,18 @@ jobs:
with:
distribution: 'zulu'
java-version: '17'
- name: Install AWK
run: sudo apt-get update && sudo apt-get install -y gawk
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Get latest tag
run: echo "VERSION=$(git describe --tags --abbrev=0)"
run: |
echo "VERSION=$(git describe --tags --abbrev=0)"
MAJOR=$(echo $VERSION | cut -d "." -f 1)
MINOR=$(echo $VERSION | cut -d "." -f 2)
PATCH=$(echo $VERSION | cut -d "." -f 3)
- name: Increment version
run: echo "NEW_VERSION=$(echo $VERSION | awk -F'v' '{print $2}' | awk -F. '{print "v"$1"."$2"."$3+1}')"
run: |
PATCH=$((PATCH + 1))
echo "NEW_VERSION=$(echo $MAJOR.$MINOR.$PATCH)"
- name: Extract commit message
run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)"
- name: Create and push tag