File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,11 +31,28 @@ jobs:
3131
3232 - name : Calculate and create tag
3333 id : version
34+ if : ${{ !inputs.force-major }}
3435 uses : mathieudutour/github-tag-action@v6.2
3536 with :
3637 github_token : ${{ secrets.GITHUB_TOKEN }}
37- default_bump : ${{ inputs.force-major && 'major' || ' patch' }}
38+ default_bump : patch
3839 release_branches : master
40+ tag_prefix : " "
41+
42+ - name : Force major version
43+ id : major
44+ if : ${{ inputs.force-major }}
45+ 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"
52+
53+ - name : Set release tag
54+ id : release
55+ run : echo "tag=${{ steps.version.outputs.new_tag || steps.major.outputs.new_tag }}" >> $GITHUB_OUTPUT
3956
4057 - name : Build with Gradle
4158 run : ./gradlew build
5875 env :
5976 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6077 run : |
61- gh release create "${{ steps.version .outputs.new_tag }}" \
62- --title "${{ steps.version .outputs.new_tag }}" \
78+ gh release create "${{ steps.release .outputs.tag }}" \
79+ --title "${{ steps.release .outputs.tag }}" \
6380 --generate-notes
6481
6582 - name : Upload JReleaser logs
You can’t perform that action at this time.
0 commit comments