-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
207 lines (182 loc) · 5.67 KB
/
publish.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: "Publish"
run-name: "Publish ${{ inputs.version }}"
env:
CI: 1
# 7 GiB by default on GitHub, setting to 6 GiB
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NODE_OPTIONS: --max-old-space-size=6144
GIT_AUTHOR_NAME: "SWC Bot"
GIT_AUTHOR_EMAIL: "[email protected]"
GIT_COMMITTER_NAME: "SWC Bot"
GIT_COMMITTER_EMAIL: "[email protected]"
# https://github.com/actions/setup-node/issues/899#issuecomment-1819151595
SKIP_YARN_COREPACK_CHECK: 1
on:
workflow_dispatch:
inputs:
version:
description: "Version to publish"
required: true
type: string
skipBuild:
description: "Skip build. Used to debug swc-ecosystem-ci."
required: false
type: boolean
default: false
onlyNightly:
description: "Publish only nightly"
required: false
type: boolean
default: false
allowBreakingWasm:
description: "Allow breaking changes in wasm"
required: false
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
cargo-bump:
name: "Bump crates"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
- name: Install cargo-edit
uses: taiki-e/install-action@v2
if: inputs.skipBuild == false
with:
tool: [email protected]
- run: cargo bump
if: inputs.skipBuild == false
continue-on-error: true
- uses: webfactory/[email protected]
if: inputs.skipBuild == false
with:
ssh-private-key: ${{ secrets.SWC_BOT_SSH }}
- name: Push bump commit
if: inputs.skipBuild == false
run: |
git push [email protected]:swc-project/swc.git --no-verify
publish-cargo:
name: "Publish cargo crates"
runs-on: ubuntu-latest
needs:
- cargo-bump
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
- uses: actions-rs/toolchain@v1
with:
profile: minimal
- name: Install cargo-edit
if: inputs.skipBuild == false
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: Install cargo-mono
if: inputs.skipBuild == false
uses: taiki-e/install-action@v2
with:
tool: [email protected]
- name: Update constant of swc_core
if: inputs.skipBuild == false
run: npx ts-node .github/bot/src/cargo/update-constants.ts
- name: Publish crates
if: inputs.skipBuild == false
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo mono publish --no-verify
determine-nightly-version:
name: "Determine nightly version"
runs-on: ubuntu-latest
outputs:
version: ${{ steps.determine-nightly-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
- name: Determine nightly version
id: determine-nightly-version
run: |
npx ts-node .github/bot/src/nightly-version.ts ${{ github.event.inputs.version }} >> $GITHUB_OUTPUT
git-tag-nightly:
name: "Git tag nightly"
runs-on: ubuntu-latest
needs:
- publish-cargo
- determine-nightly-version
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/tag-git-release
if: inputs.skipBuild == false
with:
version: ${{ needs.determine-nightly-version.outputs.version }}
ssh-private-key: ${{ secrets.SWC_BOT_SSH }}
publish-npm-nightly:
name: "Publish ${{ matrix.package }}@${{ needs.determine-nightly-version.outputs.version }}"
strategy:
fail-fast: false
matrix:
package:
- core
- html
needs:
- git-tag-nightly
- publish-cargo
- determine-nightly-version
uses: ./.github/workflows/publish-npm-package.yml
secrets: inherit
with:
package: ${{ matrix.package }}
version: ${{ needs.determine-nightly-version.outputs.version }}
buildCli: true
skipBuild: ${{ inputs.skipBuild || false }}
skipPublishing: ${{ github.event_name == 'pull_request' }}
run-ecosystem-ci-with-nightly:
name: "Test nightly using ecosystem CI"
needs:
- determine-nightly-version
- publish-npm-nightly
uses: ./.github/workflows/ecosystem-ci.yml
with:
version: ${{ needs.determine-nightly-version.outputs.version }}
mode: "passing"
suites: '["_"]'
allowBreakingWasm: ${{ inputs.allowBreakingWasm || false }}
git-tag-stable:
name: "Git tag stable"
runs-on: ubuntu-latest
needs:
- publish-cargo
- run-ecosystem-ci-with-nightly
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/tag-git-release
if: inputs.skipBuild == false
with:
version: ${{ inputs.version }}
ssh-private-key: ${{ secrets.SWC_BOT_SSH }}
publish-npm-stable:
name: "Publish ${{ matrix.package }}@${{ inputs.version || 'stable' }} to npm"
strategy:
fail-fast: false
matrix:
package:
- core
- html
needs:
- publish-cargo
- run-ecosystem-ci-with-nightly
- git-tag-stable
uses: ./.github/workflows/publish-npm-package.yml
secrets: inherit
with:
package: ${{ matrix.package }}
version: ${{ inputs.version }}
buildCli: true
skipBuild: ${{ inputs.skipBuild || inputs.onlyNightly || false }}
skipPublishing: ${{ github.event_name == 'pull_request' }}