Skip to content

Commit 33fc4ec

Browse files
committed
Allow dry run for PyPI release workflow
1 parent 7ddeb70 commit 33fc4ec

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,28 @@ on:
66
- 'v*'
77
workflow_dispatch:
88
inputs:
9+
dry_run:
10+
description: 'Dry run (use "false" to publish to PyPI)'
11+
required: true
12+
default: 'false'
913
dev_release:
10-
description: "Do a dev release or regular release"
14+
description: 'Dev release (use "false" to do a regular release)'
1115
required: true
12-
default: "false"
16+
default: 'false'
1317

1418
permissions:
1519
contents: read
1620

1721
jobs:
18-
setup:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- name: Set publishing variables
22-
run: echo "Publishing setup complete"
23-
2422
build_documentation:
2523
if: github.repository == 'ml-explore/mlx'
2624
runs-on: ubuntu-22.04
2725
steps:
2826
- uses: actions/checkout@v6
2927
- uses: ./.github/actions/build-docs
30-
28+
3129
deploy_documentation:
30+
if: github.event.inputs.dry_run == 'false'
3231
needs: build_documentation
3332
permissions:
3433
pages: write
@@ -77,7 +76,7 @@ jobs:
7776
name: mlx-cpu-${{ matrix.arch }}
7877
path: wheelhouse/mlx_cpu-*.whl
7978
if-no-files-found: error
80-
79+
8180
build_mac_release:
8281
if: github.repository == 'ml-explore/mlx'
8382
strategy:
@@ -87,7 +86,6 @@ jobs:
8786
env:
8887
PYPI_RELEASE: 1
8988
DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }}
90-
9189
steps:
9290
- uses: actions/checkout@v6
9391
- uses: ./.github/actions/setup-macos
@@ -162,7 +160,7 @@ jobs:
162160
pypi-publish:
163161
name: Upload release to PyPI
164162
runs-on: ubuntu-latest
165-
needs: [setup, build_linux_release, build_mac_release]
163+
needs: [build_linux_release, build_mac_release]
166164
permissions:
167165
id-token: write
168166
environment:
@@ -180,16 +178,17 @@ jobs:
180178
merge-multiple: true
181179
path: dist
182180
- name: Display structure of downloaded files
183-
run: ls -R dist
181+
run: ls -lR dist
184182
- name: Publish package distributions to PyPI
183+
if: github.event.inputs.dry_run == 'false'
185184
uses: pypa/gh-action-pypi-publish@release/v1
186185
with:
187186
repository-url: https://upload.pypi.org/legacy/
188-
187+
189188
pypi-publish-cuda:
190189
name: Upload CUDA release to PyPI
191190
runs-on: ubuntu-latest
192-
needs: [setup, build_cuda_release]
191+
needs: [build_cuda_release]
193192
permissions:
194193
id-token: write
195194
environment:
@@ -201,16 +200,17 @@ jobs:
201200
name: mlx-cuda-*
202201
path: dist
203202
- name: Display structure of downloaded files
204-
run: ls -R dist
203+
run: ls -lR dist
205204
- name: Publish package distributions to PyPI
205+
if: github.event.inputs.dry_run == 'false'
206206
uses: pypa/gh-action-pypi-publish@release/v1
207207
with:
208208
repository-url: https://upload.pypi.org/legacy/
209209

210210
pypi-publish-cpu:
211211
name: Upload CPU release to PyPI
212212
runs-on: ubuntu-latest
213-
needs: [setup, build_linux_release]
213+
needs: [build_linux_release]
214214
permissions:
215215
id-token: write
216216
environment:
@@ -223,16 +223,17 @@ jobs:
223223
merge-multiple: true
224224
path: dist
225225
- name: Display structure of downloaded files
226-
run: ls -R dist
226+
run: ls -lR dist
227227
- name: Publish package distributions to PyPI
228+
if: github.event.inputs.dry_run == 'false'
228229
uses: pypa/gh-action-pypi-publish@release/v1
229230
with:
230231
repository-url: https://upload.pypi.org/legacy/
231232

232233
pypi-publish-metal:
233234
name: Upload Metal release to PyPI
234235
runs-on: ubuntu-latest
235-
needs: [setup, build_mac_release]
236+
needs: [build_mac_release]
236237
permissions:
237238
id-token: write
238239
environment:
@@ -244,8 +245,9 @@ jobs:
244245
name: mlx-metal
245246
path: dist
246247
- name: Display structure of downloaded files
247-
run: ls -R dist
248+
run: ls -lR dist
248249
- name: Publish package distributions to PyPI
250+
if: github.event.inputs.dry_run == 'false'
249251
uses: pypa/gh-action-pypi-publish@release/v1
250252
with:
251253
repository-url: https://upload.pypi.org/legacy/

0 commit comments

Comments
 (0)