-
-
Notifications
You must be signed in to change notification settings - Fork 595
125 lines (113 loc) · 3.7 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
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"
jobs:
build:
name: Build Nightly
strategy:
fail-fast: false # Build and test everything so we can look at all the errors
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
- i686-pc-windows-msvc
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
uses: ./.github/workflows/reusable-build.yml
with:
target: ${{ matrix.target }}
release:
name: Release Nightly
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Main Branch
uses: actions/checkout@v3
- name: Pnpm Cache
uses: ./.github/actions/pnpm-cache
- name: Download artifacts
uses: actions/download-artifact@v3
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: ${{ always() && !contains(needs.*.result, 'failure') }}
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.ECOSYSTEM_CI_ACCESS_TOKEN }}
script: |
const result = await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
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: '-'
}
});
console.log(result);
notify:
name: Notify if failed
needs: [release]
runs-on: ubuntu-latest
if: ${{ always() && contains(needs.*.result, 'failure') }}
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.RSPACK_BOT_ACCESS_TOKEN }}
script: |
const res = await fetch(
'${{secrets.DISCORD_WEBHOOK_URL}}',
{
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
username: "nightly release",
avatar_url:
"https://raw.githubusercontent.com/web-infra-dev/rspack-website/main/docs/public/logo.png",
embeds: [
{
title: "nightly release failed",
description: "See job:\n* ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
})
}
);
console.log("res:", await res.text());