|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: workflow_dispatch |
| 4 | + |
| 5 | +jobs: |
| 6 | + semantic-release: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + environment: |
| 9 | + name: pypi |
| 10 | + url: https://pypi.org/p/trame-slicer |
| 11 | + permissions: |
| 12 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 13 | + contents: write # IMPORTANT: mandatory for making GitHub Releases |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + |
| 21 | + - name: Python Semantic Release |
| 22 | + id: release |
| 23 | + uses: python-semantic-release/python-semantic-release@master |
| 24 | + with: |
| 25 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + changelog: true |
| 27 | + build: false # build is too complex to be handled by semantic release |
| 28 | + |
| 29 | + release-build: |
| 30 | + needs: [semantic-release] |
| 31 | + strategy: |
| 32 | + fail-fast: true |
| 33 | + matrix: |
| 34 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 35 | + py-abi: ["cp310", "cp311", "cp312", "cp313"] |
| 36 | + include: |
| 37 | + # Python version to install on host |
| 38 | + - py-abi: cp310 |
| 39 | + python-version: "3.10" |
| 40 | + - py-abi: cp311 |
| 41 | + python-version: "3.11" |
| 42 | + - py-abi: cp312 |
| 43 | + python-version: "3.12" |
| 44 | + - py-abi: cp313 |
| 45 | + python-version: "3.13" |
| 46 | + # OS name to ciwheelbuild platform name |
| 47 | + - os: ubuntu-latest |
| 48 | + platform-tag: manylinux_2_28_x86_64 |
| 49 | + build-target: "manylinux_x86_64" |
| 50 | + - os: windows-latest |
| 51 | + platform-tag: win_amd64 |
| 52 | + build-target: "win_amd64" |
| 53 | + - os: macos-latest |
| 54 | + platform-tag: macosx_11_0_arm64 |
| 55 | + build-target: "macosx_arm64" |
| 56 | + uses: ./.github/workflows/build-wheels.yml |
| 57 | + with: |
| 58 | + os: ${{ matrix.os }} |
| 59 | + build-target: ${{ matrix.py-abi }}-${{ matrix.build-target }} |
| 60 | + python-version: ${{ matrix.python-version }} |
| 61 | + platform-tag: ${{ matrix.platform-tag }} |
| 62 | + |
| 63 | + upload-pypi: |
| 64 | + name: Push runtime wheel on PyPi |
| 65 | + needs: [release-build] |
| 66 | + runs-on: ubuntu-latest |
| 67 | + environment: |
| 68 | + name: pypi |
| 69 | + url: https://pypi.org/p/slicer-layer-dm |
| 70 | + permissions: |
| 71 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 72 | + |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Download all wheel artifacts |
| 77 | + uses: actions/download-artifact@v4 |
| 78 | + with: |
| 79 | + path: ./wheelhouse |
| 80 | + pattern: slicer_layer_dm-* |
| 81 | + merge-multiple: true # Flattens them into one directory |
| 82 | + |
| 83 | + # https://docs.pypi.org/trusted-publishers/using-a-publisher/ |
| 84 | + - name: Publish package distributions to PyPI |
| 85 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 86 | + with: |
| 87 | + packages-dir: ./wheelhouse |
| 88 | + |
| 89 | + upload-pypi-sdk: |
| 90 | + name: Push SDK wheel on PyPi |
| 91 | + needs: [release-build] |
| 92 | + runs-on: ubuntu-latest |
| 93 | + environment: |
| 94 | + name: pypi |
| 95 | + url: https://pypi.org/p/slicer-layer-dm-sdk |
| 96 | + permissions: |
| 97 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 98 | + |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v4 |
| 101 | + |
| 102 | + - name: Download all wheel artifacts |
| 103 | + uses: actions/download-artifact@v4 |
| 104 | + with: |
| 105 | + path: ./wheelhouse |
| 106 | + pattern: slicer_layer_dm_sdk-* |
| 107 | + merge-multiple: true # Flattens them into one directory |
| 108 | + |
| 109 | + # https://docs.pypi.org/trusted-publishers/using-a-publisher/ |
| 110 | + - name: Publish package distributions to PyPI |
| 111 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 112 | + with: |
| 113 | + packages-dir: ./wheelhouse |
0 commit comments