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,20 +180,21 @@ 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
@@ -202,20 +203,21 @@ jobs:
202203 merge-multiple : true
203204 path : dist
204205 - name : Display structure of downloaded files
205- run : ls -R dist
206+ run : du -ah dist
206207 - name : Publish package distributions to PyPI
208+ if : inputs.publish
207209 uses : pypa/gh-action-pypi-publish@release/v1
208210 with :
209211 repository-url : https://upload.pypi.org/legacy/
210212
211213 pypi-publish-cpu :
212214 name : Upload CPU release to PyPI
213215 runs-on : ubuntu-latest
214- needs : [setup, build_linux_release]
216+ needs : [build_linux_release]
215217 permissions :
216218 id-token : write
217219 environment :
218- name : pypi
220+ name : ${{ inputs.publish && ' pypi' || '' }}
219221 url : https://pypi.org/p/mlx-cpu
220222 steps :
221223 - uses : actions/download-artifact@v7
@@ -224,29 +226,31 @@ jobs:
224226 merge-multiple : true
225227 path : dist
226228 - name : Display structure of downloaded files
227- run : ls -R dist
229+ run : du -ah dist
228230 - name : Publish package distributions to PyPI
231+ if : inputs.publish
229232 uses : pypa/gh-action-pypi-publish@release/v1
230233 with :
231234 repository-url : https://upload.pypi.org/legacy/
232235
233236 pypi-publish-metal :
234237 name : Upload Metal release to PyPI
235238 runs-on : ubuntu-latest
236- needs : [setup, build_mac_release]
239+ needs : [build_mac_release]
237240 permissions :
238241 id-token : write
239242 environment :
240- name : pypi
243+ name : ${{ inputs.publish && ' pypi' || '' }}
241244 url : https://pypi.org/p/mlx-metal
242245 steps :
243246 - uses : actions/download-artifact@v7
244247 with :
245248 name : mlx-metal
246249 path : dist
247250 - name : Display structure of downloaded files
248- run : ls -R dist
251+ run : du -ah dist
249252 - name : Publish package distributions to PyPI
253+ if : inputs.publish
250254 uses : pypa/gh-action-pypi-publish@release/v1
251255 with :
252256 repository-url : https://upload.pypi.org/legacy/
0 commit comments