diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c18f77f..5da236d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: |