From 77664685ff7bbb1ab8ae07ecccf888cf83cf7140 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 Co-authored-by: Marcos Medrano <786907+mmmarcos@users.noreply.github.com> --- .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 6380ffa7440..57c75f2bd4d 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 remove" + fi + - name: Create release if: github.event_name == 'schedule' || (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