Using cut to increment version

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: with:
distribution: 'zulu' distribution: 'zulu'
java-version: '17' java-version: '17'
- name: Install AWK
run: sudo apt-get update && sudo apt-get install -y gawk
- name: Validate Gradle Wrapper - name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3 uses: gradle/actions/wrapper-validation@v3
- name: Get latest tag - 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 - 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 - name: Extract commit message
run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)" run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)"
- name: Create and push tag - name: Create and push tag