|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + release-build: |
| 11 | + runs-on: ${{ matrix.platform.runner }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + platform: |
| 15 | + - runner: ubuntu-latest |
| 16 | + os: linux |
| 17 | + target: x86_64 |
| 18 | + - runner: ubuntu-latest |
| 19 | + os: linux |
| 20 | + target: aarch64 |
| 21 | + - runner: ubuntu-latest |
| 22 | + os: linux |
| 23 | + target: i386 |
| 24 | + - runner: windows-latest |
| 25 | + os: win |
| 26 | + target: amd64 |
| 27 | + - runner: windows-latest |
| 28 | + os: win |
| 29 | + target: arm64 |
| 30 | + - runner: windows-latest |
| 31 | + os: win |
| 32 | + target: i386 |
| 33 | + - runner: macos-latest |
| 34 | + os: mac |
| 35 | + target: x86_64 |
| 36 | + - runner: macos-latest |
| 37 | + os: mac |
| 38 | + target: arm64 |
| 39 | + steps: |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v4 |
| 42 | + |
| 43 | + - name: Install uv |
| 44 | + uses: astral-sh/setup-uv@v5 |
| 45 | + |
| 46 | + - name: Install python |
| 47 | + uses: actions/setup-python@v5 |
| 48 | + with: |
| 49 | + python-version: "3.x" |
| 50 | + |
| 51 | + - name: build release distributions |
| 52 | + run: | |
| 53 | + uv build |
| 54 | +
|
| 55 | + - name: upload dists |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: release-dists |
| 59 | + path: dist/ |
| 60 | + |
| 61 | + publish-pypi: |
| 62 | + runs-on: ubuntu-latest |
| 63 | + name: Publish to PyPI |
| 64 | + if: startsWith(github.ref, 'refs/tags/') |
| 65 | + needs: |
| 66 | + - release-build |
| 67 | + permissions: |
| 68 | + id-token: write |
| 69 | + |
| 70 | + steps: |
| 71 | + - name: Retrieve release distributions |
| 72 | + uses: actions/download-artifact@v4 |
| 73 | + with: |
| 74 | + name: release-dists |
| 75 | + path: dist/ |
| 76 | + |
| 77 | + - name: Install uv |
| 78 | + uses: astral-sh/setup-uv@v5 |
| 79 | + |
| 80 | + - name: Publish release distributions to PyPI |
| 81 | + run: uv publish -v |
| 82 | + |
| 83 | + publish-release: |
| 84 | + runs-on: ubuntu-latest |
| 85 | + name: Publish to GitHub |
| 86 | + if: startsWith(github.ref, 'refs/tags/') |
| 87 | + needs: |
| 88 | + - release-build |
| 89 | + permissions: |
| 90 | + contents: write |
| 91 | + steps: |
| 92 | + - uses: actions/download-artifact@v4 |
| 93 | + with: |
| 94 | + name: release-dists |
| 95 | + path: dist/ |
| 96 | + - name: Get tag name |
| 97 | + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV |
| 98 | + - name: Publish to GitHub |
| 99 | + uses: softprops/action-gh-release@v2 |
| 100 | + with: |
| 101 | + draft: true |
| 102 | + files: dist/* |
| 103 | + tag_name: ${{ env.RELEASE_VERSION }} |
0 commit comments