|
| 1 | +# This workflow will upload a Python Package to PyPI when a release is created |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries |
| 3 | + |
| 4 | +# This workflow uses actions that are not certified by GitHub. |
| 5 | +# They are provided by a third-party and are governed by |
| 6 | +# separate terms of service, privacy policy, and support |
| 7 | +# documentation. |
| 8 | + |
| 9 | +name: Release |
| 10 | + |
| 11 | +on: |
| 12 | + push: |
| 13 | + tags: |
| 14 | + - 'v*' |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + name: Build wheels |
| 22 | + runs-on: ${{ matrix.os }} |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + include: |
| 26 | + - os: ubuntu-latest |
| 27 | + target: x86_64 |
| 28 | + - os: ubuntu-latest |
| 29 | + target: aarch64 |
| 30 | + - os: macos-latest |
| 31 | + target: x86_64 |
| 32 | + - os: macos-latest |
| 33 | + target: aarch64 |
| 34 | + - os: windows-latest |
| 35 | + target: x86_64 |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + - uses: actions/setup-python@v5 |
| 39 | + with: |
| 40 | + python-version: '3.10' |
| 41 | + - name: Build wheels |
| 42 | + uses: PyO3/maturin-action@v1 |
| 43 | + with: |
| 44 | + target: ${{ matrix.target }} |
| 45 | + args: --release --out dist --find-interpreter |
| 46 | + sccache: 'true' |
| 47 | + manylinux: auto |
| 48 | + working-directory: microbiorust-py |
| 49 | + - name: Upload wheels |
| 50 | + uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: wheels-${{ matrix.os }}-${{ matrix.target }} |
| 53 | + path: microbiorust-py/dist |
| 54 | + |
| 55 | + sdist: |
| 56 | + name: Build sdist |
| 57 | + runs-on: ubuntu-latest |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + - uses: actions/setup-python@v5 |
| 61 | + with: |
| 62 | + python-version: '3.10' |
| 63 | + - name: Build sdist |
| 64 | + uses: PyO3/maturin-action@v1 |
| 65 | + with: |
| 66 | + command: sdist |
| 67 | + args: --out dist |
| 68 | + working-directory: microbiorust-py |
| 69 | + - name: Upload sdist |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: wheels-sdist |
| 73 | + path: microbiorust-py/dist |
| 74 | + |
| 75 | + publish: |
| 76 | + name: Publish to PyPI |
| 77 | + runs-on: ubuntu-latest |
| 78 | + needs: [build, sdist] |
| 79 | + environment: pypi |
| 80 | + permissions: |
| 81 | + id-token: write # from Trusted Publishing |
| 82 | + steps: |
| 83 | + - uses: actions/download-artifact@v4 |
| 84 | + with: |
| 85 | + merge-multiple: true |
| 86 | + path: dist |
| 87 | + - name: Publish to PyPI |
| 88 | + uses: PyO3/maturin-action@v1 |
| 89 | + with: |
| 90 | + command: upload |
| 91 | + args: --non-interactive --skip-existing dist/* |
0 commit comments