44 release :
55 types :
66 - published
7+ workflow_dispatch :
8+ inputs :
9+ tag_name :
10+ description : ' Release tag to publish (e.g. v0.18.3)'
11+ required : true
712
813permissions :
914 contents : write
1015 pull-requests : write
1116
1217jobs :
1318 sonar :
14- if : " !contains(github.event.head_commit.message, '[version bump]')"
19+ if : github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, '[version bump]')
1520 runs-on : ubuntu-latest
1621 steps :
1722 - name : Checkout project
1823 uses : actions/checkout@v6
24+ with :
25+ ref : ${{ github.event.release.tag_name || github.event.inputs.tag_name || github.ref }}
1926 - name : Setup Java
2027 uses : actions/setup-java@v5
2128 with :
@@ -29,12 +36,14 @@ jobs:
2936 run : mvn -B verify sonar:sonar -Dgpg.skip
3037
3138 publish :
32- if : " !contains(github.event.head_commit.message, '[version bump]')"
39+ if : github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, '[version bump]')
3340 runs-on : ubuntu-latest
3441 needs : [ sonar ]
3542 steps :
3643 - name : Checkout project
3744 uses : actions/checkout@v6
45+ with :
46+ ref : ${{ github.event.release.tag_name || github.event.inputs.tag_name || github.ref }}
3847
3948 - name : Setup Java
4049 uses : actions/setup-java@v5
5463 git config user.name "GitHub Actions"
5564
5665 - name : Setup release version from tag
66+ env :
67+ RELEASE_TAG : ${{ github.event.release.tag_name || github.event.inputs.tag_name }}
5768 run : |
58- RELEASE_TAG="${{ github.event.release.tag_name }}"
5969 NEW_VERSION="${RELEASE_TAG#v}"
6070 echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
6171
@@ -92,14 +102,14 @@ jobs:
92102 git push origin release-$NEW_VERSION
93103
94104 bump :
95- if : " !contains(github.event.head_commit.message, '[version bump]')"
105+ if : github.event_name == 'workflow_dispatch' || !contains(github.event.head_commit.message, '[version bump]')
96106 runs-on : ubuntu-latest
97107 needs : [ publish ]
98108 steps :
99109 - name : Resolve base branch
100110 id : base
101111 run : |
102- REF="${{ github.event.release.target_commitish }}"
112+ REF="${{ github.event.release.target_commitish || 'main' }}"
103113 REF="${REF#refs/heads/}"
104114 echo "branch=${REF}" >> $GITHUB_OUTPUT
105115
@@ -123,7 +133,7 @@ jobs:
123133 - name : Bump And Update POM Version to new Development version
124134 id : bump_version
125135 run : |
126- RELEASE_VERSION="${{ github.event.release.tag_name }}"
136+ RELEASE_VERSION="${{ github.event.release.tag_name || github.event.inputs.tag_name }}"
127137 RELEASE_VERSION="${RELEASE_VERSION#v}"
128138 VERSION_PARTS=($(echo "$RELEASE_VERSION" | tr "." "\n"))
129139 NEW_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.$((VERSION_PARTS[2]+1))-SNAPSHOT"
0 commit comments