Release nightly #758
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release nightly | |
on: | |
schedule: | |
# Run at 5:30 am, daily. | |
- cron: '15 5 * * *' | |
workflow_dispatch: | |
env: | |
RUST_BACKTRACE: 1 | |
SHELL: /bin/bash | |
jobs: | |
create-draft-release: | |
# This job is only useful when run on upstream servo. | |
if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' | |
name: Create Draft GH Release | |
runs-on: ubuntu-latest | |
steps: | |
- id: create-release | |
run: | | |
NIGHTLY_TAG=$(date "+%F") | |
RELEASE_URL=$(gh release create "${NIGHTLY_TAG}" \ | |
--draft \ | |
--title "${NIGHTLY_TAG}" \ | |
--notes 'Nightly builds based on servo/servo@${{ github.sha }}' \ | |
--repo ${NIGHTLY_REPO}) | |
TEMP_TAG=$(basename "$RELEASE_URL") | |
RELEASE_ID=$( \ | |
gh api -H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"/repos/${NIGHTLY_REPO}/releases/tags/${TEMP_TAG}" \ | |
| jq '.id' \ | |
) | |
echo "RELEASE_ID=${RELEASE_ID}" >> ${GITHUB_OUTPUT} | |
env: | |
GITHUB_TOKEN: ${{ secrets.NIGHTLY_REPO_TOKEN }} | |
NIGHTLY_REPO: ${{ github.repository_owner }}/servo-nightly-builds | |
outputs: | |
release-id: ${{ steps.create-release.outputs.RELEASE_ID }} | |
publish-nightly-release: | |
# This job is only useful when run on upstream servo. | |
if: always() && (github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch') | |
name: Publish GH Release for nightly | |
runs-on: ubuntu-latest | |
steps: | |
- name: Publish as latest (success) | |
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} | |
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 | |
- name: Publish as latest (failure) | |
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }} | |
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 | |
- upload-win | |
- upload-mac | |
- upload-android | |
- upload-ohos | |
upload-win: | |
# This job is only useful when run on upstream servo. | |
if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' | |
name: Upload nightly (Windows) | |
needs: | |
- create-draft-release | |
uses: ./.github/workflows/windows.yml | |
with: | |
profile: "production" | |
upload: true | |
github-release-id: ${{ needs.create-draft-release.outputs.release-id }} | |
force-github-hosted-runner: true # <https://github.com/servo/servo/issues/33296> | |
secrets: inherit | |
upload-mac: | |
# This job is only useful when run on upstream servo. | |
if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' | |
name: Upload nightly (macOS) | |
needs: | |
- create-draft-release | |
uses: ./.github/workflows/mac.yml | |
with: | |
profile: "production" | |
upload: true | |
github-release-id: ${{ needs.create-draft-release.outputs.release-id }} | |
secrets: inherit | |
upload-linux: | |
# This job is only useful when run on upstream servo. | |
if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' | |
name: Upload nightly (Linux) | |
needs: | |
- create-draft-release | |
uses: ./.github/workflows/linux.yml | |
with: | |
profile: "production" | |
upload: true | |
github-release-id: ${{ needs.create-draft-release.outputs.release-id }} | |
force-github-hosted-runner: true # <https://github.com/servo/servo/issues/33296> | |
secrets: inherit | |
upload-android: | |
# This job is only useful when run on upstream servo. | |
if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' | |
name: Upload nightly (Android) | |
needs: | |
- create-draft-release | |
permissions: | |
id-token: write | |
attestations: write | |
uses: ./.github/workflows/android.yml | |
with: | |
profile: "release" | |
upload: true | |
github-release-id: ${{ needs.create-draft-release.outputs.release-id }} | |
secrets: inherit | |
upload-ohos: | |
# This job is only useful when run on upstream servo. | |
if: github.repository == 'servo/servo' || github.event_name == 'workflow_dispatch' | |
name: Upload nightly (OpenHarmony) | |
needs: | |
- create-draft-release | |
permissions: | |
id-token: write | |
attestations: write | |
uses: ./.github/workflows/ohos.yml | |
with: | |
profile: "release" | |
upload: true | |
github-release-id: ${{ needs.create-draft-release.outputs.release-id }} | |
secrets: inherit |