|
8 | 8 | - "v*.*.*" |
9 | 9 |
|
10 | 10 | jobs: |
11 | | - release: |
| 11 | + build: |
12 | 12 | runs-on: ubuntu-latest |
13 | 13 | if: startsWith(github.ref, 'refs/tags/v') |
14 | 14 |
|
|
30 | 30 | run: | |
31 | 31 | python setup.py sdist bdist_wheel |
32 | 32 |
|
| 33 | + - name: Store the distribution packages |
| 34 | + uses: actions/upload-artifact@v4 |
| 35 | + with: |
| 36 | + name: python-package-distributions |
| 37 | + path: dist/ |
| 38 | + |
| 39 | + publish-to-pypi: |
| 40 | + name: Publish to PyPI |
| 41 | + needs: build |
| 42 | + runs-on: ubuntu-latest |
| 43 | + permissions: |
| 44 | + id-token: write |
| 45 | + contents: write |
| 46 | + environment: |
| 47 | + name: pypi |
| 48 | + url: https://pypi.org/p/anybadge |
| 49 | + steps: |
33 | 50 | - name: Upload package to PyPI |
34 | 51 | uses: pypa/gh-action-pypi-publish@release/v1 |
35 | 52 | with: |
|
44 | 61 | env: |
45 | 62 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
46 | 63 |
|
47 | | - - name: Clean up |
48 | | - run: | |
49 | | - rm -rf dist |
| 64 | + github-release: |
| 65 | + name: >- |
| 66 | + Sign the Python 🐍 distribution 📦 with Sigstore |
| 67 | + and upload them to GitHub Release |
| 68 | + needs: |
| 69 | + - publish-to-pypi |
| 70 | + runs-on: ubuntu-latest |
| 71 | + |
| 72 | + permissions: |
| 73 | + contents: write |
| 74 | + id-token: write |
| 75 | + |
| 76 | + steps: |
| 77 | + - name: Download all the dists |
| 78 | + uses: actions/download-artifact@v4 |
| 79 | + with: |
| 80 | + name: python-package-distributions |
| 81 | + path: dist/ |
| 82 | + - name: Sign the dists with Sigstore |
| 83 | + uses: sigstore/gh-action-sigstore-python@v3.0.0 |
| 84 | + with: |
| 85 | + inputs: >- |
| 86 | + ./dist/*.tar.gz |
| 87 | + ./dist/*.whl |
| 88 | + - name: Create GitHub Release |
| 89 | + env: |
| 90 | + GITHUB_TOKEN: ${{ github.token }} |
| 91 | + run: >- |
| 92 | + gh release create |
| 93 | + "$GITHUB_REF_NAME" |
| 94 | + --repo "$GITHUB_REPOSITORY" |
| 95 | + --notes "" |
| 96 | + - name: Upload artifact signatures to GitHub Release |
| 97 | + env: |
| 98 | + GITHUB_TOKEN: ${{ github.token }} |
| 99 | + # Upload to GitHub Release using the `gh` CLI. |
| 100 | + # `dist/` contains the built packages, and the |
| 101 | + # sigstore-produced signatures and certificates. |
| 102 | + run: >- |
| 103 | + gh release upload |
| 104 | + "$GITHUB_REF_NAME" dist/** |
| 105 | + --repo "$GITHUB_REPOSITORY" |
| 106 | + - name: Cleanup |
| 107 | + run: rm -rf dist/ |
0 commit comments