rework version detection

pull/1118/head
Willy 2023-04-19 20:34:03 +02:00
parent b8aacacf5a
commit 57a12cfbc9
No known key found for this signature in database
GPG Key ID: 02E60AE5D9208602
1 changed files with 10 additions and 9 deletions

View File

@ -16,6 +16,7 @@ jobs:
outputs:
is_release: ${{ steps.versions.outputs.is_release }}
is_prerelease: ${{ steps.versions.outputs.is_prerelease }}
# this will be v1.2.3 for on-tag builds and v1.2.3-numberofcommits-sha for off-tag builds
version: ${{ steps.versions.outputs.version }}
go_version: 1.18.x
node_version: 16.14.0
@ -27,21 +28,21 @@ jobs:
- name: get version information
id: versions
run: |
STABLE_TAG=$(git describe --tags --exclude '*-*')
TAG=$(git describe --tags)
if [ "${{ github.ref }}" = "refs/tags/$TAG" ]; then
if [ "${{ github.ref }}" = "refs/tags/$STABLE_TAG" ]; then
echo "is_release=true" >> $GITHUB_OUTPUT
if [[ $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "is_prerelease=false" >> $GITHUB_OUTPUT
else
echo "is_prerelease=true" >> $GITHUB_OUTPUT
fi
echo "is_prerelease=false" >> $GITHUB_OUTPUT
echo "version=$STABLE_TAG" >> $GITHUB_OUTPUT
elif [ "${{ github.ref }}" = "refs/tags/$TAG" ]; then
echo "is_release=true" >> $GITHUB_OUTPUT
echo "is_prerelease=true" >> $GITHUB_OUTPUT
echo "version=$TAG" >> $GITHUB_OUTPUT
else
echo "is_release=false" >> $GITHUB_OUTPUT
echo "is_prerelease=false" >> $GITHUB_OUTPUT
TAG=$(git describe --tags --exclude '*-*')
echo "version=$STABLE_TAG" >> $GITHUB_OUTPUT
fi
# this will be v1.2.3 for on-tag builds and v1.2.3-numberofcommits-sha for off-tag builds
echo "version=$TAG" >> $GITHUB_OUTPUT
shell: bash
- name: show data results
run: |