66 - ' v*'
77 workflow_dispatch :
88 inputs :
9+ publish :
10+ description : ' Publish to PyPI (uncheck for dry run)'
11+ required : false
12+ type : boolean
13+ default : true
914 dev_release :
10- description : " Do a dev release or regular release"
11- required : true
12- default : " false"
15+ description : ' Development release (DEV_RELEASE=1)'
16+ required : false
17+ type : boolean
18+ default : false
1319
1420permissions :
1521 contents : read
1622
1723jobs :
18- setup :
19- runs-on : ubuntu-latest
20- steps :
21- - name : Set publishing variables
22- run : echo "Publishing setup complete"
23-
2424 build_documentation :
2525 if : github.repository == 'ml-explore/mlx'
2626 runs-on : ubuntu-22.04
2727 steps :
2828 - uses : actions/checkout@v6
2929 - uses : ./.github/actions/build-docs
30-
30+
3131 deploy_documentation :
32+ if : inputs.publish
3233 needs : build_documentation
3334 permissions :
3435 pages : write
5152 runs-on : ${{ matrix.arch == 'x86_64' && 'ubuntu-22.04' || 'ubuntu-22.04-arm' }}
5253 env :
5354 PYPI_RELEASE : 1
54- DEV_RELEASE : ${{ github.event. inputs.dev_release == 'true' && 1 || 0 }}
55+ DEV_RELEASE : ${{ inputs.dev_release && 1 || 0 }}
5556 steps :
5657 - uses : actions/checkout@v6
5758 - uses : ./.github/actions/setup-linux
7778 name : mlx-cpu-${{ matrix.arch }}
7879 path : wheelhouse/mlx_cpu-*.whl
7980 if-no-files-found : error
80-
81+
8182 build_mac_release :
8283 if : github.repository == 'ml-explore/mlx'
8384 strategy :
8687 runs-on : [self-hosted, macos]
8788 env :
8889 PYPI_RELEASE : 1
89- DEV_RELEASE : ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }}
90-
90+ DEV_RELEASE : ${{ inputs.dev_release && 1 || 0 }}
9191 steps :
9292 - uses : actions/checkout@v6
9393 - uses : ./.github/actions/setup-macos
@@ -140,7 +140,7 @@ jobs:
140140 runs-on : ${{ matrix.arch == 'x86_64' && 'ubuntu-22-large' || 'ubuntu-22-large-arm' }}
141141 env :
142142 PYPI_RELEASE : 1
143- DEV_RELEASE : ${{ github.event. inputs.dev_release == 'true' && 1 || 0 }}
143+ DEV_RELEASE : ${{ inputs.dev_release && 1 || 0 }}
144144 steps :
145145 - uses : actions/checkout@v6
146146 - uses : ./.github/actions/setup-linux
@@ -162,11 +162,11 @@ jobs:
162162 pypi-publish :
163163 name : Upload release to PyPI
164164 runs-on : ubuntu-latest
165- needs : [setup, build_linux_release, build_mac_release]
165+ needs : [build_linux_release, build_mac_release]
166166 permissions :
167167 id-token : write
168168 environment :
169- name : pypi
169+ name : ${{ inputs.publish && ' pypi' || '' }}
170170 url : https://pypi.org/p/mlx
171171 steps :
172172 - uses : actions/download-artifact@v7
@@ -180,41 +180,43 @@ jobs:
180180 merge-multiple : true
181181 path : dist
182182 - name : Display structure of downloaded files
183- run : ls -R dist
183+ run : du -ah dist
184184 - name : Publish package distributions to PyPI
185+ if : inputs.publish
185186 uses : pypa/gh-action-pypi-publish@release/v1
186187 with :
187188 repository-url : https://upload.pypi.org/legacy/
188-
189+
189190 pypi-publish-cuda :
190191 name : Upload CUDA release to PyPI
191192 runs-on : ubuntu-latest
192- needs : [setup, build_cuda_release]
193+ needs : [build_cuda_release]
193194 permissions :
194195 id-token : write
195196 environment :
196- name : pypi
197+ name : ${{ inputs.publish && ' pypi' || '' }}
197198 url : https://pypi.org/p/mlx-cuda
198199 steps :
199200 - uses : actions/download-artifact@v7
200201 with :
201202 name : mlx-cuda-*
202203 path : dist
203204 - name : Display structure of downloaded files
204- run : ls -R dist
205+ run : du -ah dist
205206 - name : Publish package distributions to PyPI
207+ if : inputs.publish
206208 uses : pypa/gh-action-pypi-publish@release/v1
207209 with :
208210 repository-url : https://upload.pypi.org/legacy/
209211
210212 pypi-publish-cpu :
211213 name : Upload CPU release to PyPI
212214 runs-on : ubuntu-latest
213- needs : [setup, build_linux_release]
215+ needs : [build_linux_release]
214216 permissions :
215217 id-token : write
216218 environment :
217- name : pypi
219+ name : ${{ inputs.publish && ' pypi' || '' }}
218220 url : https://pypi.org/p/mlx-cpu
219221 steps :
220222 - uses : actions/download-artifact@v7
@@ -223,29 +225,31 @@ jobs:
223225 merge-multiple : true
224226 path : dist
225227 - name : Display structure of downloaded files
226- run : ls -R dist
228+ run : du -ah dist
227229 - name : Publish package distributions to PyPI
230+ if : inputs.publish
228231 uses : pypa/gh-action-pypi-publish@release/v1
229232 with :
230233 repository-url : https://upload.pypi.org/legacy/
231234
232235 pypi-publish-metal :
233236 name : Upload Metal release to PyPI
234237 runs-on : ubuntu-latest
235- needs : [setup, build_mac_release]
238+ needs : [build_mac_release]
236239 permissions :
237240 id-token : write
238241 environment :
239- name : pypi
242+ name : ${{ inputs.publish && ' pypi' || '' }}
240243 url : https://pypi.org/p/mlx-metal
241244 steps :
242245 - uses : actions/download-artifact@v7
243246 with :
244247 name : mlx-metal
245248 path : dist
246249 - name : Display structure of downloaded files
247- run : ls -R dist
250+ run : du -ah dist
248251 - name : Publish package distributions to PyPI
252+ if : inputs.publish
249253 uses : pypa/gh-action-pypi-publish@release/v1
250254 with :
251255 repository-url : https://upload.pypi.org/legacy/
0 commit comments