From 4491ecea628a543f89f4ba66be9321b6ca0ad51a Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Sun, 31 Oct 2021 13:34:26 +0000 Subject: [PATCH] Only trigger automatic release process on annotated tags (#881) * Only trigger release process on annotated tags Annotated tags are meant for releases while lightweight tags are meant for private or temporary object labels. For this reason, we should not trigger the automatic release actions unless we have an annotated tag. * Actions set-output is only scoped within the same job id * Fix workflow syntax - of course keys cannot be defined twice --- .github/workflows/tests.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2c859d1..d082e3b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -479,6 +479,10 @@ jobs: name: binaries path: binaries + # Given the clearly documented use of annotated tags to signal releases, + # it seems strange that there is no simple way to trigger actions if the + # tag is annotated. So we need to jump through some hoops. + # upload_release: name: Upload Release Assets if: startsWith(github.ref, 'refs/tags/') @@ -492,12 +496,18 @@ jobs: runs-on: ubuntu-latest steps: + - name: Get Tag Type + run: | + echo '::set-output name=TAGTYPE::$(git cat-file -t $GITHUB_REF)' + - name: Fetch all Artifacts + if: steps.get_tagtype.outputs.TAGTYPE == 'tag' uses: actions/download-artifact@v2 with: path: artifacts - name: Upload Assets to Release + if: steps.get_tagtype.outputs.TAGTYPE == 'tag' uses: softprops/action-gh-release@v1 with: prerelease: true