@@ -4,9 +4,13 @@ name: 'Reusable - Generate Version'
44on :
55 workflow_call :
66 inputs :
7- version_strategy_or_hash :
8- description : ' Major, Minor, Patch or commit hash '
9- required : true
7+ RELEASE_TYPE :
8+ description : ' Major, Minor, Patch'
9+ required : false
10+ type : string
11+ COMMIT_HASH :
12+ description : ' The commit hash to be used for the release'
13+ required : false
1014 type : string
1115
1216 outputs :
@@ -39,11 +43,15 @@ jobs:
3943 env :
4044 BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
4145 steps :
46+ - name : Validate only one property is set
47+ run : |
48+ [[ $(( ${RELEASE_TYPE:++1} + ${COMMIT_HASH:++1} )) -eq 1 ]] || { echo "Error: Exactly one of RELEASE_TYPE or COMMIT_HASH must be set." >&2; exit 1; }
49+
4250 - name : Checkout
4351 uses : actions/checkout@v4
4452 - name : Stores the commit hash as environment variable
4553 run : |
46- commit_hash=$(./scripts/get-commit.sh ${{ env.BRANCH_NAME }} ${{ github.event. inputs.commit_hash }})
54+ commit_hash=$(./scripts/get-commit.sh ${{ env.BRANCH_NAME }} ${{ inputs.COMMIT_HASH }})
4755 echo "Commit is set to \"$commit_hash\""
4856 echo "COMMIT_HASH=$commit_hash" >> $GITHUB_ENV
4957 echo "SHORT_COMMIT_HASH=$(git rev-parse --short $commit_hash)" >> $GITHUB_ENV
5664 update-version :
5765 runs-on : ubuntu-24.04
5866 needs : find-commit
59- if : github.event. inputs.deployment_type != 'Release from Commit '
67+ if : inputs.RELEASE_TYPE != ''
6068 env :
6169 BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
6270 steps :
6674 ref : ${{env.BRANCH_NAME}}
6775
6876 - name : Update version
69- run : ./scripts/update-mvn-version.sh "${{ github.event. inputs.deployment_type }}"
77+ run : ./scripts/update-mvn-version.sh "${{ inputs.RELEASE_TYPE }}"
7078
7179 - name : Commit and Push Changes
7280 shell : bash
0 commit comments