From f545b83604ea76b37720209dd4fcad37e7efb4f3 Mon Sep 17 00:00:00 2001 From: Firelight Flagboy Date: Tue, 12 Mar 2024 09:33:46 +0100 Subject: [PATCH] Remove previous nightly release if it exists --- .github/workflows/releaser.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 56ecc9838f3..c7fddef499a 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -20,6 +20,9 @@ concurrency: group: releaser-${{ github.workflow }}-${{ github.ref_name }} cancel-in-progress: true +env: + NIGHTLY_RELEASE: ${{ (github.event_name == 'schedule' || github.ref == 'refs/tags/nightly') && 'true' || 'false' }} + jobs: scheduled-nightly-build: if: github.event_name == 'schedule' @@ -142,15 +145,24 @@ jobs: echo "$EOF" ) | tee -a $GITHUB_OUTPUT + - name: Remove previous nightly release + if: env.NIGHTLY_RELEASE == 'true' + run: | + if gh release view nightly; then + gh release delete nightly + else + echo "No nightly release to delete" + fi + - name: Create release if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') # FIXME: rollback to `softprops/action-gh-release` once the issue is fixed. uses: FirelightFlagboy/action-gh-release@d9a17b2b70a11ff00e4a7d0be3ca04e74d66de24 with: - draft: true + draft: ${{ env.NIGHTLY_RELEASE != 'true' }} body: ${{ steps.summary.outputs.output }} prerelease: ${{ needs.version.outputs.pre != '' || needs.version.outputs.dev != '' || needs.version.outputs.local != '' }} - name: ${{ github.ref_name == 'nightly' && 'Nightly release' || format('Release v{0}', needs.version.outputs.full) }} + name: ${{ env.NIGHTLY_RELEASE == 'true' && 'Nightly release' || format('Release v{0}', needs.version.outputs.full) }} files: | release-files/parsec_cloud-${{ needs.version.outputs.pep440 }}-*.whl release-files/parsec_cloud-${{ needs.version.outputs.pep440 }}-*.whl.sha256