name: Build and publish wheels # To run this manually: # 1. Build each platform using `scripts/ci/build_and_upload_wheels.py` # 2. (optional) Generate index using `scripts/ci/generate_prerelease_pip_index.py` # 3. Publish to PyPI using `scripts/ci/publish_wheels.py` on: workflow_call: inputs: concurrency: type: string required: true release-version: description: "Release Version Number (Must match Cargo.toml)" type: string required: true release-commit: description: "Which commit to build+publish" type: string required: true defaults: run: shell: bash --noprofile --norc -euo pipefail {0} permissions: contents: "read" id-token: "write" packages: "read" jobs: get-commit-sha: name: Get Commit Sha runs-on: ubuntu-latest outputs: short-sha: ${{ steps.get-short-sha.outputs.short-sha }} full-sha: ${{ steps.get-full-sha.outputs.full-sha }} steps: - name: "Set short-sha" id: get-short-sha run: echo "short-sha=$(echo ${{ inputs.release-commit }} | cut -c1-7)" >> $GITHUB_OUTPUT - name: "Set full-sha" id: get-full-sha run: echo "full-sha=${{ inputs.release-commit }}" >> $GITHUB_OUTPUT ## Build # Note: this also builds `rerun_notebook` build-linux-x64: name: "Linux-x64: Build Wheels" needs: [get-commit-sha] uses: ./.github/workflows/reusable_build_and_upload_wheels.yml with: CONCURRENCY: wheels-build-linux-x64-${{ inputs.concurrency }} PLATFORM: linux-x64 WHEEL_ARTIFACT_NAME: linux-x64-wheel RELEASE_COMMIT: ${{ inputs.release-commit }} MODE: "pypi" secrets: inherit build-linux-arm64: name: "Linux-arm64: Build Wheels" needs: [get-commit-sha] uses: ./.github/workflows/reusable_build_and_upload_wheels.yml with: CONCURRENCY: wheels-build-linux-arm64-${{ inputs.concurrency }} PLATFORM: linux-arm64 WHEEL_ARTIFACT_NAME: linux-arm64-wheel RELEASE_COMMIT: ${{ inputs.release-commit }} MODE: "pypi" secrets: inherit build-windows-x64: name: "Windows-x64: Build Wheels" needs: [get-commit-sha] uses: ./.github/workflows/reusable_build_and_upload_wheels.yml with: CONCURRENCY: wheels-build-windows-x64-${{ inputs.concurrency }} PLATFORM: windows-x64 WHEEL_ARTIFACT_NAME: windows-x64-wheel RELEASE_COMMIT: ${{ inputs.release-commit }} MODE: "pypi" secrets: inherit build-macos-arm64: name: "Macos-arm64: Build Wheels" needs: [get-commit-sha] uses: ./.github/workflows/reusable_build_and_upload_wheels.yml with: CONCURRENCY: wheels-build-macos-arm64-${{ inputs.concurrency }} PLATFORM: macos-arm64 WHEEL_ARTIFACT_NAME: macos-arm64-wheel RELEASE_COMMIT: ${{ inputs.release-commit }} MODE: "pypi" secrets: inherit generate-wheel-index: name: "Generate Pip Index" needs: [build-linux-x64, build-linux-arm64, build-windows-x64, build-macos-arm64] uses: ./.github/workflows/reusable_pip_index.yml with: CONCURRENCY: generate-wheel-index-${{ inputs.concurrency }} COMMIT: ${{ inputs.release-commit }} secrets: inherit publish-wheels: name: "Publish Wheels" needs: [get-commit-sha, generate-wheel-index] runs-on: ubuntu-latest-16-cores steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 # Don't do a shallow clone since we need it for finding the full commit hash ref: ${{ inputs.release-commit }} - uses: prefix-dev/setup-pixi@v0.10.0 with: pixi-version: v0.71.3 - id: "auth" uses: google-github-actions/auth@v2 with: workload_identity_provider: ${{ secrets.GOOGLE_WORKLOAD_IDENTITY_PROVIDER }} service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }} - name: "Set up Cloud SDK" uses: "google-github-actions/setup-gcloud@v2" with: version: ">= 363.0.0" - name: Publish to PyPI run: | pixi run uvpy scripts/ci/publish_wheels.py \ --version ${{ inputs.release-version }} \ --dir "commit/${{ needs.get-commit-sha.outputs.short-sha }}/wheels" \ --repository "${{ vars.PYPI_REPOSITORY }}" \ --token "${{ secrets.MATURIN_PYPI_TOKEN }}" \