| 1 |
name: Release |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main |
| 7 |
pull_request: |
| 8 |
workflow_dispatch: |
| 9 |
# allow manual runs on branches without a PR |
| 10 |
release: |
| 11 |
types: |
| 12 |
- published |
| 13 |
|
| 14 |
concurrency: |
| 15 |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} |
| 16 |
cancel-in-progress: true |
| 17 |
|
| 18 |
permissions: {} |
| 19 |
|
| 20 |
jobs: |
| 21 |
dist: |
| 22 |
name: Build dist |
| 23 |
runs-on: ubuntu-latest |
| 24 |
permissions: |
| 25 |
contents: read |
| 26 |
steps: |
| 27 |
- name: Checkout |
| 28 |
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 29 |
with: |
| 30 |
fetch-depth: 0 # required for setuptools_scm to find tags |
| 31 |
persist-credentials: false |
| 32 |
- name: Build dist |
| 33 |
# This action builds the distributions and uploads them as an artifact named "Packages", |
| 34 |
# which is later downloaded in the `publish` job via actions/download-artifact. |
| 35 |
uses: hynek/build-and-inspect-python-package@fe0a0fb1925ca263d076ca4f2c13e93a6e92a33e # v2.17.0 |
| 36 |
|
| 37 |
publish: |
| 38 |
name: Publish to PyPI |
| 39 |
needs: [dist] |
| 40 |
runs-on: ubuntu-latest |
| 41 |
if: github.event_name == 'release' && github.event.action == 'published' |
| 42 |
environment: |
| 43 |
name: pypi |
| 44 |
url: https://pypi.org/p/auditwheel |
| 45 |
permissions: |
| 46 |
attestations: write # for attestation generation |
| 47 |
id-token: write # for trusted publishing |
| 48 |
|
| 49 |
steps: |
| 50 |
- name: Download dist artefacts |
| 51 |
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 52 |
with: |
| 53 |
name: Packages |
| 54 |
path: dist |
| 55 |
|
| 56 |
- name: Generate artifact attestation for sdist and wheel |
| 57 |
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0 |
| 58 |
with: |
| 59 |
subject-path: "dist/auditwheel-*" |
| 60 |
|
| 61 |
- name: Publish to PyPI |
| 62 |
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 |
| 63 |
with: |
| 64 |
attestations: true |