|
| 1 | +# gitxtend PyPI publish — fires on a vX.Y.Z tag or workflow_dispatch. |
| 2 | +# |
| 3 | +# HOOK PARITY: this pipeline is additive (publish is not mirrored by the pre-push |
| 4 | +# hook — uploading to PyPI is a release gate only). The pre-push hook runs the |
| 5 | +# same build + test steps that the `check` job in ci.yml runs. |
| 6 | +# |
| 7 | +# Publishes abi3 maturin wheels for: |
| 8 | +# - linux x86_64 + aarch64 (via QEMU) |
| 9 | +# - macOS x86_64 + arm64 (via two native runners, combined into universal2) |
| 10 | +# - windows x86_64 |
| 11 | +# |
| 12 | +# The wheel uses cp39 abi3 (--interpreter python3.9 --abi3) so one wheel covers |
| 13 | +# Python 3.9+ on each platform. pyproject.toml declares requires-python = ">=3.11" |
| 14 | +# which is still compatible (the abi3 tag is the build ABI floor, not the runtime |
| 15 | +# floor — pip enforces pyproject.toml's requires-python separately). |
| 16 | + |
| 17 | +name: publish |
| 18 | + |
| 19 | +on: |
| 20 | + push: |
| 21 | + tags: |
| 22 | + - "v[0-9]+.[0-9]+.[0-9]+" |
| 23 | + workflow_dispatch: |
| 24 | + inputs: |
| 25 | + tag: |
| 26 | + description: "Tag to publish (e.g. v0.1.0)" |
| 27 | + required: true |
| 28 | + |
| 29 | +env: |
| 30 | + CARGO_TERM_COLOR: always |
| 31 | + # maturin needs this to pick the right Python for abi3 builds. |
| 32 | + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 33 | + |
| 34 | +jobs: |
| 35 | + # ── Linux x86_64 + aarch64 (manylinux) ─────────────────────────────────── |
| 36 | + linux: |
| 37 | + name: linux (${{ matrix.target }}) |
| 38 | + runs-on: ubuntu-latest |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + target: [x86_64, aarch64] |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + - uses: actions/setup-python@v5 |
| 45 | + with: |
| 46 | + python-version: "3.11" |
| 47 | + - name: build wheel (manylinux abi3) |
| 48 | + uses: PyO3/maturin-action@v1 |
| 49 | + with: |
| 50 | + target: ${{ matrix.target }} |
| 51 | + args: --release --out dist --features extension-module --interpreter python3.11 --abi3 |
| 52 | + manylinux: auto |
| 53 | + sccache: "true" |
| 54 | + - uses: actions/upload-artifact@v4 |
| 55 | + with: |
| 56 | + name: wheels-linux-${{ matrix.target }} |
| 57 | + path: dist |
| 58 | + |
| 59 | + # ── macOS x86_64 + arm64 (combined into universal2) ────────────────────── |
| 60 | + macos: |
| 61 | + name: macos (universal2) |
| 62 | + runs-on: macos-latest |
| 63 | + steps: |
| 64 | + - uses: actions/checkout@v4 |
| 65 | + - uses: actions/setup-python@v5 |
| 66 | + with: |
| 67 | + python-version: "3.11" |
| 68 | + - name: build wheel (universal2 abi3) |
| 69 | + uses: PyO3/maturin-action@v1 |
| 70 | + with: |
| 71 | + target: universal2-apple-darwin |
| 72 | + args: --release --out dist --features extension-module --interpreter python3.11 --abi3 |
| 73 | + sccache: "true" |
| 74 | + - uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + name: wheels-macos-universal2 |
| 77 | + path: dist |
| 78 | + |
| 79 | + # ── Windows x86_64 ─────────────────────────────────────────────────────── |
| 80 | + windows: |
| 81 | + name: windows (x86_64) |
| 82 | + runs-on: windows-latest |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + - uses: actions/setup-python@v5 |
| 86 | + with: |
| 87 | + python-version: "3.11" |
| 88 | + - name: build wheel (abi3) |
| 89 | + uses: PyO3/maturin-action@v1 |
| 90 | + with: |
| 91 | + target: x86_64 |
| 92 | + args: --release --out dist --features extension-module --interpreter python3.11 --abi3 |
| 93 | + sccache: "true" |
| 94 | + - uses: actions/upload-artifact@v4 |
| 95 | + with: |
| 96 | + name: wheels-windows-x86_64 |
| 97 | + path: dist |
| 98 | + |
| 99 | + # ── sdist ──────────────────────────────────────────────────────────────── |
| 100 | + sdist: |
| 101 | + name: sdist |
| 102 | + runs-on: ubuntu-latest |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v4 |
| 105 | + - name: build sdist |
| 106 | + uses: PyO3/maturin-action@v1 |
| 107 | + with: |
| 108 | + command: sdist |
| 109 | + args: --out dist |
| 110 | + - uses: actions/upload-artifact@v4 |
| 111 | + with: |
| 112 | + name: wheels-sdist |
| 113 | + path: dist |
| 114 | + |
| 115 | + # ── Upload to PyPI ──────────────────────────────────────────────────────── |
| 116 | + release: |
| 117 | + name: upload to PyPI |
| 118 | + runs-on: ubuntu-latest |
| 119 | + needs: [linux, macos, windows, sdist] |
| 120 | + environment: |
| 121 | + name: pypi |
| 122 | + url: https://pypi.org/p/gitxtend |
| 123 | + permissions: |
| 124 | + id-token: write |
| 125 | + steps: |
| 126 | + - uses: actions/download-artifact@v4 |
| 127 | + with: |
| 128 | + pattern: wheels-* |
| 129 | + merge-multiple: true |
| 130 | + path: dist |
| 131 | + - name: publish |
| 132 | + uses: PyO3/maturin-action@v1 |
| 133 | + with: |
| 134 | + command: upload |
| 135 | + args: --non-interactive --skip-existing dist/* |
0 commit comments