|
| 1 | +name: Release of packages |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: |
| 6 | + - published |
| 7 | + |
| 8 | +jobs: |
| 9 | + dist: |
| 10 | + name: Release distribution packages |
| 11 | + |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: |
| 15 | + - ubuntu-24.04 |
| 16 | + - ubuntu-24.04-arm |
| 17 | + - macos-15 |
| 18 | + - macos-15-intel |
| 19 | + - windows-2025 |
| 20 | + - windows-11-arm |
| 21 | + python-version: |
| 22 | + - '3.11' |
| 23 | + - '3.12' |
| 24 | + - '3.13' |
| 25 | + |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v6 |
| 31 | + |
| 32 | + - name: Set up Python |
| 33 | + uses: actions/setup-python@v6 |
| 34 | + with: |
| 35 | + python-version: ${{ matrix.python-version }} |
| 36 | + |
| 37 | + - name: Install dependencies |
| 38 | + run: | |
| 39 | + python -m pip install --upgrade pip |
| 40 | + python -m pip install setuptools wheel build cython |
| 41 | +
|
| 42 | + - name: Build wheel and source tarball |
| 43 | + run: | |
| 44 | + python -m build |
| 45 | +
|
| 46 | + - name: Store distribution |
| 47 | + uses: actions/upload-artifact@v6 |
| 48 | + with: |
| 49 | + name: python-package-distributions |
| 50 | + path: dist/ |
| 51 | + |
| 52 | + pypi: |
| 53 | + name: Publish distribution |
| 54 | + |
| 55 | + needs: |
| 56 | + - dist |
| 57 | + |
| 58 | + runs-on: ubuntu-latest |
| 59 | + |
| 60 | + environment: |
| 61 | + name: pypi |
| 62 | + url: https://pypi.org/p/softfloatpy |
| 63 | + |
| 64 | + permissions: |
| 65 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 66 | + |
| 67 | + steps: |
| 68 | + - name: Download distribution |
| 69 | + uses: actions/download-artifact@v7 |
| 70 | + with: |
| 71 | + name: python-package-distributions |
| 72 | + path: dist/ |
| 73 | + |
| 74 | + - name: Publish distribution to PyPI |
| 75 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 76 | + |
| 77 | + github-release: |
| 78 | + needs: |
| 79 | + - dist |
| 80 | + |
| 81 | + runs-on: ubuntu-latest |
| 82 | + |
| 83 | + permissions: |
| 84 | + contents: write # IMPORTANT: mandatory for making GitHub Releases |
| 85 | + id-token: write # IMPORTANT: mandatory for sigstore |
| 86 | + |
| 87 | + steps: |
| 88 | + - name: Download distribution |
| 89 | + uses: actions/download-artifact@v7 |
| 90 | + with: |
| 91 | + name: python-package-distributions |
| 92 | + path: dist/ |
| 93 | + |
| 94 | + - name: Sign distribution with Sigstore |
| 95 | + |
| 96 | + with: |
| 97 | + inputs: ./dist/*.tar.gz ./dist/*.whl |
| 98 | + |
| 99 | + - name: Upload artifact signatures to GitHub Release |
| 100 | + env: |
| 101 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 102 | + # Upload to GitHub Release using the `gh` CLI. |
| 103 | + # `dist/` contains the built packages, and the |
| 104 | + # sigstore-produced signatures and certificates. |
| 105 | + run: | |
| 106 | + gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}' --clobber |
0 commit comments