From 76c9ff0dd4f807bfc88d54aabae82575b223762d Mon Sep 17 00:00:00 2001 From: Willy Date: Tue, 25 Jan 2022 11:01:51 +0100 Subject: [PATCH] create a github release from workflow artifacts on stable/unstable runs this is based on the artifact's file names, currently `statping-*`. --- .github/workflows/build.yml | 49 +++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6286a123..93eb782d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -201,21 +201,6 @@ jobs: name: statping-${{ matrix.platform }}-${{ matrix.arch }} path: ./build - # TODO this should be its own job - DONT CREATE A RELEASE ON DEV - - name: Upload Releases - id: upload-assets - uses: softprops/action-gh-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - VERSION: ${{ env.VERSION }} - with: - # TODO add "dev-" prefix for unstable - # TODO only do this for stable/unstable pushes - tag_name: v${{ env.VERSION }} - draft: true - prerelease: true - files: build/${{ env.compressed }} - - name: Upload Compiled Binaries to S3 # temporarily disabled if: "false" @@ -486,10 +471,14 @@ jobs: # all other release jobs should be based on this release-precondition-check: + # only run release jobs on push to stable/unstable + # sadly, you can't use ${{ env.is_release }} here if: | + success() && ( github.event_name == 'push' && (github.ref == 'refs/heads/stable' || github.ref == 'refs/heads/unstable') + ) needs: [ build, test-postman-sqlite, test-postman-mysql, test-postman-postgres ] runs-on: ubuntu-latest steps: @@ -497,7 +486,35 @@ jobs: run: | : - # TODO i got lazy here + github-release: + runs-on: ubuntu-latest + needs: release-precondition-check + steps: + # TODO read version somewhere *once* and use output globally + - name: Checkout Statping Repo + uses: actions/checkout@v2 + - name: Setting ENV's + run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV + - name: Download job artifacts + uses: actions/download-artifact@v2 + with: + path: downloads + - name: Accumulate files + run: | + mkdir files + find downloads -type f -exec cp {} files \; + - name: Upload Releases + id: upload-assets + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ env.VERSION }} + with: + # add "dev-" prefix for unstable releases + tag_name: ${{ env.is_unstable && 'dev-' || '' }}v${{ env.VERSION }} + draft: true + prerelease: true + files: files/statping-* docker-release: needs: release-precondition-check