diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40b082f447..a5b6976ece 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,29 +6,30 @@ on: - 'v*' workflow_dispatch: inputs: + publish: + description: 'Publish to PyPI (uncheck for dry run)' + required: false + type: boolean + default: true dev_release: - description: "Do a dev release or regular release" - required: true - default: "false" + description: 'Development release (DEV_RELEASE=1)' + required: false + type: boolean + default: false permissions: contents: read jobs: - setup: - runs-on: ubuntu-latest - steps: - - name: Set publishing variables - run: echo "Publishing setup complete" - build_documentation: if: github.repository == 'ml-explore/mlx' runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v6 - uses: ./.github/actions/build-docs - + deploy_documentation: + if: inputs.publish needs: build_documentation permissions: pages: write @@ -51,7 +52,7 @@ jobs: runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-22.04' || 'ubuntu-22.04-arm' }} env: PYPI_RELEASE: 1 - DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }} + DEV_RELEASE: ${{ inputs.dev_release && 1 || 0 }} steps: - uses: actions/checkout@v6 - uses: ./.github/actions/setup-linux @@ -77,7 +78,7 @@ jobs: name: mlx-cpu-${{ matrix.arch }} path: wheelhouse/mlx_cpu-*.whl if-no-files-found: error - + build_mac_release: if: github.repository == 'ml-explore/mlx' strategy: @@ -86,8 +87,7 @@ jobs: runs-on: [self-hosted, macos] env: PYPI_RELEASE: 1 - DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }} - + DEV_RELEASE: ${{ inputs.dev_release && 1 || 0 }} steps: - uses: actions/checkout@v6 - uses: ./.github/actions/setup-macos @@ -140,7 +140,7 @@ jobs: runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-22-large' || 'ubuntu-22-large-arm' }} env: PYPI_RELEASE: 1 - DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }} + DEV_RELEASE: ${{ inputs.dev_release && 1 || 0 }} steps: - uses: actions/checkout@v6 - uses: ./.github/actions/setup-linux @@ -162,11 +162,11 @@ jobs: pypi-publish: name: Upload release to PyPI runs-on: ubuntu-latest - needs: [setup, build_linux_release, build_mac_release] + needs: [build_linux_release, build_mac_release] permissions: id-token: write environment: - name: pypi + name: ${{ inputs.publish && 'pypi' || '' }} url: https://pypi.org/p/mlx steps: - uses: actions/download-artifact@v7 @@ -180,20 +180,21 @@ jobs: merge-multiple: true path: dist - name: Display structure of downloaded files - run: ls -R dist + run: du -ah dist - name: Publish package distributions to PyPI + if: inputs.publish uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://upload.pypi.org/legacy/ - + pypi-publish-cuda: name: Upload CUDA release to PyPI runs-on: ubuntu-latest - needs: [setup, build_cuda_release] + needs: [build_cuda_release] permissions: id-token: write environment: - name: pypi + name: ${{ inputs.publish && 'pypi' || '' }} url: https://pypi.org/p/mlx-cuda steps: - uses: actions/download-artifact@v7 @@ -201,8 +202,9 @@ jobs: name: mlx-cuda-* path: dist - name: Display structure of downloaded files - run: ls -R dist + run: du -ah dist - name: Publish package distributions to PyPI + if: inputs.publish uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://upload.pypi.org/legacy/ @@ -210,11 +212,11 @@ jobs: pypi-publish-cpu: name: Upload CPU release to PyPI runs-on: ubuntu-latest - needs: [setup, build_linux_release] + needs: [build_linux_release] permissions: id-token: write environment: - name: pypi + name: ${{ inputs.publish && 'pypi' || '' }} url: https://pypi.org/p/mlx-cpu steps: - uses: actions/download-artifact@v7 @@ -223,8 +225,9 @@ jobs: merge-multiple: true path: dist - name: Display structure of downloaded files - run: ls -R dist + run: du -ah dist - name: Publish package distributions to PyPI + if: inputs.publish uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://upload.pypi.org/legacy/ @@ -232,11 +235,11 @@ jobs: pypi-publish-metal: name: Upload Metal release to PyPI runs-on: ubuntu-latest - needs: [setup, build_mac_release] + needs: [build_mac_release] permissions: id-token: write environment: - name: pypi + name: ${{ inputs.publish && 'pypi' || '' }} url: https://pypi.org/p/mlx-metal steps: - uses: actions/download-artifact@v7 @@ -244,8 +247,9 @@ jobs: name: mlx-metal path: dist - name: Display structure of downloaded files - run: ls -R dist + run: du -ah dist - name: Publish package distributions to PyPI + if: inputs.publish uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://upload.pypi.org/legacy/