1+ name : Get semantic release version
2+ description : " "
3+ inputs :
4+ custom_version : # Optional input for a custom version
5+ description : " Custom version to publish (e.g., v1.2.3) -- only edit if you know what you are doing"
6+ required : false
7+ token :
8+ description : " Personal Access Token"
9+ required : true
10+ default : " "
11+ outputs :
12+ release_version :
13+ description : " The release version to use (e.g., v1.2.3)"
14+ value : ${{ steps.get_release_version.outputs.release_version }}
15+ version_without_prefix :
16+ description : " The release version to use without 'v' (e.g., 1.2.3)"
17+ value : ${{ steps.get_release_version_without_prefix.outputs.version_without_prefix }}
18+ highest_semver_tag :
19+ description : " The highest semantic version tag without the 'v' prefix (e.g., 1.2.3)"
20+ value : ${{ steps.get_highest_semver.outputs.highest_semver_tag }}
21+ runs :
22+ using : composite
23+ steps :
24+ - uses : actions/checkout@v4
25+ - name : Get release version
26+ id : get_release_version
27+ shell : bash
28+ env :
29+ GITHUB_TOKEN : ${{ inputs.token }}
30+ GIT_AUTHOR_NAME : feast-ci-bot
31+ GIT_AUTHOR_EMAIL : feast-ci-bot@willem.co
32+ GIT_COMMITTER_NAME : feast-ci-bot
33+ GIT_COMMITTER_EMAIL : feast-ci-bot@willem.co
34+ run : |
35+ if [[ -n "${{ inputs.custom_version }}" ]]; then
36+ VERSION_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$"
37+ echo "Using custom version: ${{ inputs.custom_version }}"
38+ if [[ ! "${{ inputs.custom_version }}" =~ $VERSION_REGEX ]]; then
39+ echo "Error: custom_version must match semantic versioning (e.g., v1.2.3)."
40+ exit 1
41+ fi
42+ echo "::set-output name=release_version::${{ inputs.custom_version }}"
43+ elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
44+ echo "Using tag reference: ${GITHUB_REF#refs/tags/}"
45+ echo "::set-output name=release_version::${GITHUB_REF#refs/tags/}"
46+ else
47+ echo "Defaulting to branch name: ${GITHUB_REF#refs/heads/}"
48+ echo "::set-output name=release_version::${GITHUB_REF#refs/heads/}"
49+ fi
50+ - name : Get release version without prefix
51+ id : get_release_version_without_prefix
52+ shell : bash
53+ env :
54+ RELEASE_VERSION : ${{ steps.get_release_version.outputs.release_version }}
55+ run : |
56+ if [[ "${RELEASE_VERSION}" == v* ]]; then
57+ echo "::set-output name=version_without_prefix::${RELEASE_VERSION:1}"
58+ else
59+ echo "::set-output name=version_without_prefix::${RELEASE_VERSION}"
60+ fi
61+ - name : Get highest semver
62+ id : get_highest_semver
63+ shell : bash
64+ env :
65+ RELEASE_VERSION : ${{ steps.get_release_version.outputs.release_version }}
66+ run : |
67+ if [[ -n "${{ inputs.custom_version }}" ]]; then
68+ HIGHEST_SEMVER_TAG="${{ inputs.custom_version }}"
69+ echo "::set-output name=highest_semver_tag::$HIGHEST_SEMVER_TAG"
70+ echo "Using custom version as highest semantic version: $HIGHEST_SEMVER_TAG"
71+ else
72+ source infra/scripts/setup-common-functions.sh
73+ SEMVER_REGEX='^v[0-9]+\.[0-9]+\.[0-9]+(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$'
74+ if echo "${RELEASE_VERSION}" | grep -P "$SEMVER_REGEX" &>/dev/null ; then
75+ echo ::set-output name=highest_semver_tag::$(get_tag_release -m)
76+ echo "Using infra/scripts/setup-common-functions.sh to generate highest semantic version: $HIGHEST_SEMVER_TAG"
77+ fi
78+ fi
79+ - name : Check output
80+ shell : bash
81+ env :
82+ RELEASE_VERSION : ${{ steps.get_release_version.outputs.release_version }}
83+ VERSION_WITHOUT_PREFIX : ${{ steps.get_release_version_without_prefix.outputs.version_without_prefix }}
84+ HIGHEST_SEMVER_TAG : ${{ steps.get_highest_semver.outputs.highest_semver_tag }}
85+ run : |
86+ echo $RELEASE_VERSION
87+ echo $VERSION_WITHOUT_PREFIX
88+ echo $HIGHEST_SEMVER_TAG
0 commit comments