@@ -2,6 +2,44 @@ name: Release
22
33on :
44 workflow_dispatch :
5+ inputs :
6+ mode :
7+ description : ' Release mode'
8+ type : choice
9+ options :
10+ - release
11+ - candidate
12+ default : release
13+ js-sdk :
14+ description : ' Release JS SDK (candidate only)'
15+ required : false
16+ default : false
17+ type : boolean
18+ python-sdk :
19+ description : ' Release Python SDK (candidate only)'
20+ required : false
21+ default : false
22+ type : boolean
23+ cli :
24+ description : ' Release CLI (candidate only)'
25+ required : false
26+ default : false
27+ type : boolean
28+ tag :
29+ description : ' Dist-tag for candidate (e.g. rc, beta, snapshot)'
30+ required : false
31+ default : ' rc'
32+ type : string
33+ preid :
34+ description : ' Prerelease identifier (defaults to branch name, candidate only)'
35+ required : false
36+ default : ' '
37+ type : string
38+ skip-tests :
39+ description : ' Skip tests (candidate only)'
40+ required : false
41+ default : false
42+ type : boolean
543
644concurrency : ${{ github.workflow }}-${{ github.ref }}
745
@@ -10,11 +48,16 @@ permissions:
1048 contents : write
1149
1250jobs :
13- is_release :
14- name : Is release?
51+ # ── Production release ───────────────────────────────────
52+ preflight :
53+ name : Release preflight
54+ if : github.event.inputs.mode != 'candidate'
1555 runs-on : ubuntu-latest
1656 outputs :
1757 release : ${{ steps.version.outputs.release }}
58+ js-sdk : ${{ steps.js.outputs.release }}
59+ python-sdk : ${{ steps.python.outputs.release }}
60+ cli : ${{ steps.cli.outputs.release }}
1861 steps :
1962 - name : Checkout Repo
2063 uses : actions/checkout@v3
@@ -54,91 +97,52 @@ jobs:
5497 IS_RELEASE=$(./.github/scripts/is_release.sh)
5598 echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
5699
57- changes :
58- name : Repository changes
59- needs : [is_release]
60- if : needs.is_release.outputs.release == 'true'
61- runs-on : ubuntu-latest
62- outputs :
63- js-sdk : ${{ steps.js.outputs.release }}
64- python-sdk : ${{ steps.python.outputs.release }}
65- cli : ${{ steps.cli.outputs.release }}
66- steps :
67- - name : Checkout Repo
68- uses : actions/checkout@v3
69-
70- - name : Parse .tool-versions
71- uses : wistia/parse-tool-versions@v2.1.1
72- with :
73- filename : ' .tool-versions'
74- uppercase : ' true'
75- prefix : ' tool_version_'
76-
77- - name : Install pnpm
78- uses : pnpm/action-setup@v4
79- id : pnpm-install
80- with :
81- version : ' ${{ env.TOOL_VERSION_PNPM }}'
82-
83- - name : Setup Node
84- uses : actions/setup-node@v6
85- with :
86- node-version : ' ${{ env.TOOL_VERSION_NODEJS }}'
87- registry-url : ' https://registry.npmjs.org'
88- cache : pnpm
89- cache-dependency-path : pnpm-lock.yaml
90-
91- - name : Configure pnpm
92- run : |
93- pnpm config set auto-install-peers true
94- pnpm config set exclude-links-from-lockfile true
95-
96- - name : Install dependencies
97- run : pnpm install --frozen-lockfile
98-
99- - name : Check JavasScript SDK Release
100+ - name : Check JavaScript SDK Release
100101 id : js
102+ if : steps.version.outputs.release == 'true'
101103 run : |
102104 IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "e2b")
103105 echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
104106
105107 - name : Check Python SDK Release
106108 id : python
109+ if : steps.version.outputs.release == 'true'
107110 run : |
108111 IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/python-sdk")
109112 echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
110113
111114 - name : Check CLI Release
112115 id : cli
116+ if : steps.version.outputs.release == 'true'
113117 run : |
114118 IS_RELEASE=$(./.github/scripts/is_release_for_package.sh "@e2b/cli")
115119 echo "release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
116120
117121 python-tests :
118122 name : Python SDK Tests
119- needs : [changes ]
120- if : needs.changes .outputs.python-sdk == 'true'
123+ needs : [preflight ]
124+ if : needs.preflight .outputs.python-sdk == 'true'
121125 uses : ./.github/workflows/python_sdk_tests.yml
122126 secrets : inherit
123127
124128 js-tests :
125129 name : JS SDK Tests
126- needs : [changes ]
127- if : needs.changes .outputs.js-sdk == 'true'
130+ needs : [preflight ]
131+ if : needs.preflight .outputs.js-sdk == 'true'
128132 uses : ./.github/workflows/js_sdk_tests.yml
129133 secrets : inherit
130134
131135 cli-tests :
132136 name : CLI Tests
133- needs : [changes ]
134- if : needs.changes .outputs.cli == 'true'
137+ needs : [preflight ]
138+ if : needs.preflight .outputs.cli == 'true'
135139 uses : ./.github/workflows/cli_tests.yml
136140 secrets : inherit
137141
138142 publish :
139143 name : Publish
140- needs : [is_release , python-tests, js-tests, cli-tests]
141- if : (!cancelled()) && !contains(needs.*.result, 'failure') && needs.is_release .outputs.release == 'true'
144+ needs : [preflight , python-tests, js-tests, cli-tests]
145+ if : (!cancelled()) && !contains(needs.*.result, 'failure') && needs.preflight .outputs.release == 'true'
142146 uses : ./.github/workflows/publish_packages.yml
143147 secrets : inherit
144148
@@ -156,3 +160,58 @@ jobs:
156160 SLACK_TITLE : Release Failed
157161 SLACK_WEBHOOK : ${{ secrets.SLACK_WEBHOOK }}
158162 SLACK_CHANNEL : ' monitoring-releases'
163+
164+ # ── Release candidate ────────────────────────────────────
165+ rc-validate :
166+ name : Validate RC inputs
167+ if : github.event.inputs.mode == 'candidate'
168+ runs-on : ubuntu-latest
169+ outputs :
170+ preid : ${{ steps.preid.outputs.preid }}
171+ steps :
172+ - name : Block production tags
173+ run : |
174+ if [ "${{ github.event.inputs.tag }}" = "latest" ]; then
175+ echo "::error::Publishing with the 'latest' tag is not allowed for candidates. Use 'release' mode instead."
176+ exit 1
177+ fi
178+
179+ - name : Sanitize preid
180+ id : preid
181+ run : |
182+ RAW_PREID="${{ github.event.inputs.preid || github.ref_name }}"
183+ echo "preid=$(echo "$RAW_PREID" | sed 's/[^0-9A-Za-z-]/-/g')" >> "$GITHUB_OUTPUT"
184+
185+ rc-python-tests :
186+ name : RC Python Tests
187+ needs : [rc-validate]
188+ if : github.event.inputs.python-sdk == 'true' && github.event.inputs.skip-tests != 'true'
189+ uses : ./.github/workflows/python_sdk_tests.yml
190+ secrets : inherit
191+
192+ rc-js-tests :
193+ name : RC JS Tests
194+ needs : [rc-validate]
195+ if : github.event.inputs.js-sdk == 'true' && github.event.inputs.skip-tests != 'true'
196+ uses : ./.github/workflows/js_sdk_tests.yml
197+ secrets : inherit
198+
199+ rc-cli-tests :
200+ name : RC CLI Tests
201+ needs : [rc-validate]
202+ if : github.event.inputs.cli == 'true' && github.event.inputs.skip-tests != 'true'
203+ uses : ./.github/workflows/cli_tests.yml
204+ secrets : inherit
205+
206+ rc-publish :
207+ name : Publish RC
208+ needs : [rc-validate, rc-python-tests, rc-js-tests, rc-cli-tests]
209+ if : (!cancelled()) && !contains(needs.*.result, 'failure')
210+ uses : ./.github/workflows/publish_candidates.yml
211+ with :
212+ js-sdk : ${{ github.event.inputs.js-sdk == 'true' }}
213+ python-sdk : ${{ github.event.inputs.python-sdk == 'true' }}
214+ cli : ${{ github.event.inputs.cli == 'true' }}
215+ tag : ${{ github.event.inputs.tag }}
216+ preid : ${{ needs.rc-validate.outputs.preid }}
217+ secrets : inherit
0 commit comments