-
Notifications
You must be signed in to change notification settings - Fork 11
307 lines (268 loc) · 9.03 KB
/
Copy pathrelease.yml
File metadata and controls
307 lines (268 loc) · 9.03 KB
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch:
inputs:
reuse_run_id:
description: "Run ID to reuse build artifacts from, skipping build/PyPI/conda (leave empty for a normal release)"
required: false
tag:
description: "Release tag, e.g. 1.8.0 (only used when reuse_run_id is set; the dispatch ref is not the tag)"
required: false
prerelease:
description: "Mark as a prerelease (only used when reuse_run_id is set)"
type: boolean
default: false
skip_npm:
description: "Skip npm publish (use when it already succeeded on a prior attempt)"
type: boolean
default: false
permissions:
contents: read
concurrency:
group: release
cancel-in-progress: false
jobs:
build:
name: Build and verify release artifacts
if: inputs.reuse_run_id == ''
runs-on: ubuntu-latest
outputs:
prerelease: ${{ steps.version.outputs.prerelease }}
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout the tagged source
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up release build environment
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: release-build
channels: conda-forge
conda-build-version: "*"
miniforge-version: latest
python-version: "3.13"
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
package-manager-cache: false
- name: Validate tag and version metadata
id: version
run: |
git merge-base --is-ancestor "$GITHUB_SHA" origin/main
python scripts/release.py check --tag "$GITHUB_REF_NAME"
echo "prerelease=$(python scripts/release.py show prerelease)" >> "$GITHUB_OUTPUT"
- name: Install release build tools
run: |
python -m pip install --disable-pip-version-check build twine
- name: Build JavaScript and npm package
working-directory: ipywidgets_bokeh
run: |
npm ci --no-audit --no-fund
npm run build
mkdir -p ../release-artifacts/npm
npm pack --ignore-scripts --pack-destination ../release-artifacts/npm
- name: Build Python distributions
run: |
python -m build --outdir release-artifacts/python
python -m twine check release-artifacts/python/*
- name: Build and test conda package
run: |
conda install --yes conda-package-handling
conda build conda.recipe \
--no-anaconda-upload \
--output-folder release-artifacts/conda
- name: Verify release artifacts
run: |
python scripts/release.py verify-artifacts release-artifacts \
--checksums release-artifacts/SHA256SUMS
- name: Upload Python distributions
uses: actions/upload-artifact@v4
with:
name: python-distributions
path: release-artifacts/python/*
if-no-files-found: error
retention-days: 30
- name: Upload npm package
uses: actions/upload-artifact@v4
with:
name: npm-package
path: release-artifacts/npm/*.tgz
if-no-files-found: error
retention-days: 30
- name: Upload conda package
uses: actions/upload-artifact@v4
with:
name: conda-package
path: |
release-artifacts/conda/**/*.conda
release-artifacts/conda/**/*.tar.bz2
if-no-files-found: error
retention-days: 30
- name: Upload checksums
uses: actions/upload-artifact@v4
with:
name: release-checksums
path: release-artifacts/SHA256SUMS
if-no-files-found: error
retention-days: 30
publish-pypi:
name: Publish to PyPI
needs: build
if: inputs.reuse_run_id == '' && always() && !failure() && !cancelled()
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
id-token: write
steps:
- name: Download Python distributions
uses: actions/download-artifact@v4
with:
name: python-distributions
path: dist
- name: Publish Python distributions
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
publish-npm:
name: Publish to npm
needs: build
if: inputs.skip_npm != true && always() && !failure() && !cancelled()
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
id-token: write
actions: read
steps:
- name: Set up Node.js for trusted publishing
uses: actions/setup-node@v6
with:
node-version: "24"
package-manager-cache: false
registry-url: https://registry.npmjs.org
- name: Download npm package
uses: actions/download-artifact@v4
with:
name: npm-package
path: dist
run-id: ${{ inputs.reuse_run_id || github.run_id }}
github-token: ${{ github.token }}
- name: Publish npm package
env:
PRERELEASE: ${{ needs.build.outputs.prerelease || inputs.prerelease }}
run: |
args=(--access public)
if [[ "$PRERELEASE" == "true" ]]; then
args+=(--tag next)
fi
npm publish ./dist/*.tgz "${args[@]}"
publish-conda:
name: Publish to Anaconda.org
needs: build
if: inputs.reuse_run_id == '' && always() && !failure() && !cancelled()
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
defaults:
run:
shell: bash -el {0}
steps:
- name: Set up Anaconda client
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: release-publish
channels: conda-forge
miniforge-version: latest
python-version: "3.13"
- name: Install Anaconda client
run: conda install --yes anaconda-client
- name: Download conda package
uses: actions/download-artifact@v4
with:
name: conda-package
path: dist
- name: Publish conda package
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
PRERELEASE: ${{ needs.build.outputs.prerelease || inputs.prerelease }}
run: |
if [[ -z "$ANACONDA_API_TOKEN" ]]; then
echo "ANACONDA_API_TOKEN is not configured in the release environment" >&2
exit 1
fi
mapfile -t packages < <(find dist -type f \( -name '*.conda' -o -name '*.tar.bz2' \))
if [[ ${#packages[@]} -ne 1 ]]; then
echo "expected one conda package, found ${#packages[@]}" >&2
exit 1
fi
labels=(--label dev)
if [[ "$PRERELEASE" != "true" ]]; then
labels+=(--label main)
fi
anaconda --token "$ANACONDA_API_TOKEN" upload \
--user bokeh \
"${labels[@]}" \
"${packages[0]}"
github-release:
name: Create GitHub Release
needs: [build, publish-pypi, publish-npm, publish-conda]
if: always() && !failure() && !cancelled()
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
actions: read
steps:
- name: Checkout the tagged source
uses: actions/checkout@v6
with:
ref: ${{ inputs.tag || github.ref_name }}
- name: Download Python distributions
uses: actions/download-artifact@v4
with:
name: python-distributions
path: artifacts/python
run-id: ${{ inputs.reuse_run_id || github.run_id }}
github-token: ${{ github.token }}
- name: Download npm package
uses: actions/download-artifact@v4
with:
name: npm-package
path: artifacts/npm
run-id: ${{ inputs.reuse_run_id || github.run_id }}
github-token: ${{ github.token }}
- name: Download conda package
uses: actions/download-artifact@v4
with:
name: conda-package
path: artifacts/conda
run-id: ${{ inputs.reuse_run_id || github.run_id }}
github-token: ${{ github.token }}
- name: Download checksums
uses: actions/download-artifact@v4
with:
name: release-checksums
path: artifacts/checksums
run-id: ${{ inputs.reuse_run_id || github.run_id }}
github-token: ${{ github.token }}
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
PRERELEASE: ${{ needs.build.outputs.prerelease || inputs.prerelease }}
TAG: ${{ inputs.tag || github.ref_name }}
run: |
args=(--verify-tag --generate-notes --title "$TAG")
if [[ "$PRERELEASE" == "true" ]]; then
args+=(--prerelease)
fi
mapfile -t assets < <(find artifacts -type f)
gh release create "$TAG" "${assets[@]}" "${args[@]}"