|
1 | | -name: Build Binaries |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
|
7 | 7 | workflow_dispatch: |
8 | 8 | inputs: |
9 | 9 | tag: |
10 | | - description: "Release tag to append binaries to (e.g., v2.0.0)" |
| 10 | + description: "Release tag to build binaries for (e.g., v2.0.0)" |
11 | 11 | required: true |
12 | 12 | type: string |
13 | 13 |
|
14 | 14 | jobs: |
| 15 | + publish-pypi: |
| 16 | + name: Publish to PyPI |
| 17 | + runs-on: ubuntu-latest |
| 18 | + if: github.event_name == 'push' |
| 19 | + environment: pypi |
| 20 | + permissions: |
| 21 | + id-token: write |
| 22 | + contents: write |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v5 |
| 25 | + |
| 26 | + - name: Install uv and setup the python version |
| 27 | + uses: astral-sh/setup-uv@v7 |
| 28 | + |
| 29 | + - name: Install the project |
| 30 | + run: uv sync --all-groups |
| 31 | + |
| 32 | + - name: Run tests |
| 33 | + run: uv run pytest |
| 34 | + |
| 35 | + - name: Build wheel |
| 36 | + run: uv build |
| 37 | + |
| 38 | + - name: Publish package |
| 39 | + env: |
| 40 | + UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |
| 41 | + run: uv publish |
| 42 | + |
| 43 | + - name: Create GitHub Release |
| 44 | + uses: softprops/action-gh-release@v2 |
| 45 | + with: |
| 46 | + generate_release_notes: true |
| 47 | + body: | |
| 48 | + ## Installation |
| 49 | +
|
| 50 | + ```bash |
| 51 | + pipx install kseal==${{ github.ref_name }} |
| 52 | + ``` |
| 53 | +
|
| 54 | + ## PyPI Package |
| 55 | + https://pypi.org/project/kseal/${{ github.ref_name }}/ |
| 56 | +
|
| 57 | + --- |
| 58 | +
|
15 | 59 | build: |
16 | 60 | name: Build (${{ matrix.os }}-${{ matrix.arch }}) |
17 | 61 | runs-on: ${{ matrix.runner }} |
@@ -63,9 +107,10 @@ jobs: |
63 | 107 | name: kseal-${{ matrix.os }}-${{ matrix.arch }} |
64 | 108 | path: dist/kseal-${{ matrix.os }}-${{ matrix.arch }} |
65 | 109 |
|
66 | | - release: |
67 | | - name: Append to Release |
68 | | - needs: build |
| 110 | + upload-binaries: |
| 111 | + name: Upload Binaries to Release |
| 112 | + needs: [build, publish-pypi] |
| 113 | + if: always() && needs.build.result == 'success' && (needs.publish-pypi.result == 'success' || needs.publish-pypi.result == 'skipped') |
69 | 114 | runs-on: ubuntu-latest |
70 | 115 | permissions: |
71 | 116 | contents: write |
|
78 | 123 | path: binaries |
79 | 124 | merge-multiple: true |
80 | 125 |
|
81 | | - - name: List binaries |
82 | | - run: ls -la binaries/ |
83 | | - |
84 | 126 | - name: Upload binaries to release |
85 | 127 | env: |
86 | 128 | GH_TOKEN: ${{ github.token }} |
|
0 commit comments