diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a2bab26197e..42b1a027ec8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -41,21 +41,32 @@ jobs: publish-nightly-release: # This job is only useful when run on upstream servo. - if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' + if: always() && (github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch') name: Publish GH Release for nightly runs-on: ubuntu-20.04 steps: - - run: | + - name: Publish as latest (success) + if: success() + run: | gh api \ --method PATCH \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ /repos/${NIGHTLY_REPO}/releases/${RELEASE_ID} \ -F draft=false - env: - GITHUB_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }} - NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds - RELEASE_ID: ${{ needs.create-draft-release.outputs.release-id }} + - name: Publish as latest (failure) + if: failure() + run: | + gh api \ + --method PATCH \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${NIGHTLY_REPO}/releases/${RELEASE_ID} \ + -F prerelease=true -F draft=false + env: + GITHUB_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }} + NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds + RELEASE_ID: ${{ needs.create-draft-release.outputs.release-id }} needs: - create-draft-release - upload-linux