-
-
Notifications
You must be signed in to change notification settings - Fork 595
139 lines (125 loc) · 4.57 KB
/
release-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
131
132
133
134
135
136
137
138
139
name: Release Nightly
on:
workflow_dispatch:
schedule:
# 08:00 AM Beijing Time. Except Tuesday, which is for full release
- cron: "0 0 * * 0,1,3,4,5,6"
permissions:
# To publish packages with provenance
id-token: write
contents: write
jobs:
get-runner-labels:
name: Get Runner Labels
if: github.repository_owner == 'web-infra-dev'
uses: ./.github/workflows/get-runner-labels.yml
with:
force-use-github-runner: true
build:
name: Build Nightly
if: github.repository_owner == 'web-infra-dev'
needs: [get-runner-labels]
strategy:
fail-fast: false # Build and test everything so we can look at all the errors
matrix:
array:
- target: x86_64-unknown-linux-gnu
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: aarch64-unknown-linux-gnu
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: x86_64-unknown-linux-musl
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: aarch64-unknown-linux-musl
runner: ${{ needs.get-runner-labels.outputs.LINUX_RUNNER_LABELS }}
- target: i686-pc-windows-msvc
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
- target: x86_64-pc-windows-msvc
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
- target: aarch64-pc-windows-msvc
runner: ${{ needs.get-runner-labels.outputs.WINDOWS_RUNNER_LABELS }}
- target: x86_64-apple-darwin
runner: ${{ needs.get-runner-labels.outputs.MACOS_RUNNER_LABELS }}
- target: aarch64-apple-darwin
runner: ${{ needs.get-runner-labels.outputs.MACOS_RUNNER_LABELS }}
uses: ./.github/workflows/reusable-build.yml
with:
target: ${{ matrix.array.target }}
runner: ${{ matrix.array.runner }}
release:
name: Release Nightly
if: github.repository_owner == 'web-infra-dev'
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Main Branch
uses: actions/checkout@v4
- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache
- name: Download artifacts
uses: actions/[email protected]
with:
path: artifacts
- name: Build node packages
run: pnpm run build:js
- name: Move artifacts
run: node scripts/build-npm.cjs
- name: Show binding packages
run: ls -R npm
- name: Resolve dependencies for bindings
run: pnpm install --no-frozen-lockfile
- name: Publish
id: publish
run: |
./x version snapshot
./x publish snapshot --tag nightly
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
REPOSITORY: ${{ github.repository }}
REF: ${{ github.ref }}
ONLY_RELEASE_TAG: true
outputs:
version: ${{ steps.publish.outputs.version }}
trigger-ecosystem-ci:
name: Trigger Ecosystem CI if successed
needs: [release]
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'web-infra-dev' && success() }}
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.RSPACK_ACCESS_TOKEN }}
script: |
const result = await github.rest.actions.createWorkflowDispatch({
owner: 'rspack-contrib',
repo: 'rspack-ecosystem-ci',
workflow_id: 'ecosystem-ci-selected.yml',
ref: 'main',
inputs: {
refType: 'release',
ref: '${{ needs.release.outputs.version }}',
repo: 'web-infra-dev/rspack',
suite: '-',
suiteRefType: 'precoded',
suiteRef: 'precoded',
}
});
console.log(result);
notify:
name: Notify if failed
needs: [release]
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'web-infra-dev' && failure() && !cancelled() }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- shell: bash
run: ./scripts/alert/lark.js
env:
TITLE: Nightly release failed
DESCRIPTION: |
commitID: [${{github.sha}}](${{github.server_url}}/${{github.repository}}/commit/${{github.sha}})
URL: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
LARK_WEBHOOK_URL: ${{secrets.LARK_WEBHOOK_URL}}