forked from servo/servo
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (122 loc) · 4.39 KB
/
nightly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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-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 }}
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 }}
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