-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
137 lines (125 loc) · 3.96 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
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: "bot@swc.rs"
GIT_COMMITTER_NAME: "SWC Bot"
GIT_COMMITTER_EMAIL: "bot@swc.rs"
# 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:
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:
- 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
- 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
if: inputs.onlyNightly == false
needs:
- 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:
- 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' }}