Skip to content

Commit 424e0c7

Browse files
committed
chore: add version support for manual GHA runs
Signed-off-by: BRIAN GLEESON <Brian.Gleeson@ie.ibm.com>
1 parent e356423 commit 424e0c7

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

.github/workflows/publish.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
- main
77
workflow_dispatch:
88
inputs:
9+
version:
10+
description: 'Version number (e.g. 2.0.8) - leave empty to use branch/tag name'
11+
required: false
12+
type: string
13+
default: ''
914
publish_maven:
1015
description: 'Publish to Maven'
1116
required: false
@@ -58,10 +63,19 @@ jobs:
5863
distribution: 'temurin'
5964
cache: 'maven'
6065

66+
- name: Determine version
67+
id: version
68+
run: |
69+
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.version }}" ]; then
70+
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
71+
else
72+
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
73+
fi
74+
6175
- name: Publish Javadocs
6276
env:
6377
GITHUB_REPO_SLUG: ${{ github.repository }}
64-
GITHUB_TAG: ${{ github.ref_name}}
78+
GITHUB_TAG: ${{ steps.version.outputs.version }}
6579
run: |
6680
main/build/publishJavadoc-gha.sh
6781
@@ -93,8 +107,17 @@ jobs:
93107
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
94108
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
95109

110+
- name: Determine version
111+
id: version
112+
run: |
113+
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.version }}" ]; then
114+
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
115+
else
116+
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
117+
fi
118+
96119
- name: Set Maven version
97-
run: mvn versions:set -DnewVersion=${{ github.ref_name }} -DgenerateBackupPoms=false
120+
run: mvn versions:set -DnewVersion=${{ steps.version.outputs.version }} -DgenerateBackupPoms=false
98121

99122
- name: Deploy to Maven Central
100123
env:

0 commit comments

Comments
 (0)