From 0fe7ddffb0e35a63e1f6e098ad18e2fe9e0dda66 Mon Sep 17 00:00:00 2001 From: _neronotte Date: Mon, 2 Sep 2024 20:14:51 +0200 Subject: [PATCH] Update build.yml Properly handled version tags --- .github/workflows/build.yml | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7324ceb..bab981d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,15 +70,31 @@ jobs: - name: Find NuGet package id: find_package run: echo "::set-output name=package::$(Get-ChildItem -Recurse -Filter *.nupkg | Select-Object -First 1).FullName" - + + - name: Check for tags + id: check_tags + run: | + if [ -z "$(git tag)" ]; then + echo "No tags found" + echo "::set-output name=has_tags::false" + else + echo "::set-output name=has_tags::true" + fi + - name: Get previous release tag id: prev_tag + if: steps.check_tags.outputs.has_tags == 'true' run: echo "::set-output name=tag::$(git describe --tags --abbrev=0 HEAD^)" - name: Get commit messages id: commit_messages - run: echo "::set-output name=messages::$(git log ${{ steps.prev_tag.outputs.tag }}..HEAD --pretty=format:'%s')" - + run: | + if [ "${{ steps.check_tags.outputs.has_tags }}" == "true" ]; then + echo "::set-output name=messages::$(git log ${{ steps.prev_tag.outputs.tag }}..HEAD --pretty=format:'%s')" + else + echo "::set-output name=messages::$(git log --pretty=format:'%s')" + fi + - name: Create GitHub Release uses: actions/create-release@v1 env: