.github, ts_python: add GitHub workflow to publish to PyPI #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: python | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| linux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: linux-arm64-16cpu | |
| target: aarch64 | |
| - runner: linux-x86_64-16cpu | |
| target: x86_64 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: 3.12 | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 | |
| with: | |
| working-directory: ts_python | |
| rust-toolchain: stable | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| manylinux: auto | |
| - name: Build free-threaded wheels | |
| uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 | |
| with: | |
| working-directory: ts_python | |
| rust-toolchain: stable | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --interpreter python3.14t | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| manylinux: auto | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: wheels-linux-${{ matrix.platform.target }} | |
| path: ts_python/dist | |
| macos: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| matrix: | |
| platform: | |
| - runner: macos-26 | |
| target: aarch64 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: 3.12 | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 | |
| with: | |
| working-directory: ts_python | |
| rust-toolchain: stable | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: 3.14t | |
| - name: Build free-threaded wheels | |
| uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 | |
| with: | |
| working-directory: ts_python | |
| rust-toolchain: stable | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist -i python3.14t | |
| sccache: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: wheels-macos-${{ matrix.platform.target }} | |
| path: ts_python/dist | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| # if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} | |
| needs: [linux, macos] | |
| permissions: | |
| # Use to sign the release artifacts | |
| id-token: write | |
| # Used to upload release artifacts | |
| contents: write | |
| # Used to generate artifact attestation | |
| attestations: write | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| - name: Generate artifact attestation | |
| uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0 | |
| with: | |
| subject-path: 'wheels-*/*' | |
| - name: Install uv | |
| # if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| - name: Publish to PyPI | |
| # if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| run: uv publish --index testpypi 'wheels-*/*' |