ci: remove unfinished draft releases
@@ -130,6 +130,8 @@ jobs:
name: Build assets
needs: [create_release, cache_info, update_deps]
runs-on: ${{ matrix.config.os }}
+ outputs:
+ status: ${{ job.status }}
strategy:
fail-fast: false
matrix:
@@ -300,3 +302,15 @@ jobs:
hub release edit --draft=false \
-m 'Release ${{ needs.create_release.outputs.version }}' \
${{ needs.create_release.outputs.tag }}
+
+ remove_failed_release:
+ name: Remove the release upon a build failure
+ needs: [create_release, build_assets]
+ runs-on: ubuntu-latest
+ # we need always() to force the check to run even if one of the needed jobs fails
+ if: ${{ always() && needs.build_assets.outputs.status == 'failure' }}
+ steps:
+ - name: Remove release
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: gh release delete ${{ needs.create_release.outputs.version }}
