@@ -31,21 +31,40 @@ jobs:
3131 highest_semver_tag : ${{ steps.get_highest_semver.outputs.highest_semver_tag }}
3232 steps :
3333 - uses : actions/checkout@v4
34+ - name : Validate custom version input
35+ id : validate_custom_version
36+ run : |
37+ if [[ -n "${{ github.event.inputs.custom_version }}" ]]; then
38+ VERSION_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$"
39+ if [[ ! "${{ github.event.inputs.custom_version }}" =~ $VERSION_REGEX ]]; then
40+ echo "Error: custom_version must match semantic versioning (e.g., v1.2.3)."
41+ exit 1
42+ fi
43+ echo "Validated custom version: ${{ github.event.inputs.custom_version }}"
44+ fi
3445 - name : Get release version
3546 id : get_release_version
3647 run : |
3748 if [[ -n "${{ github.event.inputs.custom_version }}" ]]; then
3849 echo "Using custom version: ${{ github.event.inputs.custom_version }}"
3950 echo "::set-output name=release_version::${{ github.event.inputs.custom_version }}"
51+ elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
52+ echo "Using tag reference: ${GITHUB_REF#refs/tags/}"
53+ echo "::set-output name=release_version::${GITHUB_REF#refs/tags/}"
4054 else
41- echo ::set-output name=release_version::${GITHUB_REF#refs/*/}
55+ echo "Defaulting to branch name: ${GITHUB_REF#refs/heads/}"
56+ echo "::set-output name=release_version::${GITHUB_REF#refs/heads/}"
4257 fi
4358 - name : Get release version without prefix
4459 id : get_release_version_without_prefix
4560 env :
4661 RELEASE_VERSION : ${{ steps.get_release_version.outputs.release_version }}
4762 run : |
48- echo ::set-output name=version_without_prefix::${RELEASE_VERSION:1}
63+ if [[ "${RELEASE_VERSION}" == v* ]]; then
64+ echo "::set-output name=version_without_prefix::${RELEASE_VERSION:1}"
65+ else
66+ echo "::set-output name=version_without_prefix::${RELEASE_VERSION}"
67+ fi
4968 - name : Get highest semver
5069 id : get_highest_semver
5170 env :
0 commit comments