@@ -3,11 +3,10 @@ name: Release
33on :
44 workflow_dispatch :
55 inputs :
6- force-major :
7- description : ' Force major version bump '
6+ version :
7+ description : ' Version to release (leave empty for auto-detection based on commits) '
88 required : false
9- type : boolean
10- default : false
9+ type : string
1110
1211jobs :
1312 release :
@@ -29,30 +28,26 @@ jobs:
2928 - name : Setup Gradle
3029 uses : gradle/actions/setup-gradle@v4
3130
32- - name : Calculate and create tag
33- id : version
34- if : ${{ !inputs.force-major }}
31+ - name : Auto-detect version
32+ id : auto
33+ if : ${{ !inputs.version }}
3534 uses : mathieudutour/github-tag-action@v6.2
3635 with :
3736 github_token : ${{ secrets.GITHUB_TOKEN }}
3837 default_bump : patch
3938 release_branches : master
4039 tag_prefix : " "
4140
42- - name : Force major version
43- id : major
44- if : ${{ inputs.force-major }}
41+ - name : Manual version
42+ id : manual
43+ if : ${{ inputs.version }}
4544 run : |
46- LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")
47- IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_TAG"
48- NEW_VERSION="$((MAJOR + 1)).0.0"
49- echo "new_tag=$NEW_VERSION" >> $GITHUB_OUTPUT
50- git tag "$NEW_VERSION"
51- git push origin "$NEW_VERSION"
45+ git tag "${{ inputs.version }}"
46+ git push origin "${{ inputs.version }}"
5247
5348 - name : Set release tag
5449 id : release
55- run : echo "tag=${{ steps .version.outputs.new_tag || steps.major .outputs.new_tag }}" >> $GITHUB_OUTPUT
50+ run : echo "tag=${{ inputs .version || steps.auto .outputs.new_tag }}" >> $GITHUB_OUTPUT
5651
5752 - name : Build with Gradle
5853 run : ./gradlew build
0 commit comments