Skip to content

Commit a7ade44

Browse files
release pipeline: attach build artifacts to the GitHub release, trigger on published
1 parent 8aae3c8 commit a7ade44

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/build.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
name: Upload Python Package to PyPI when a Release is Created
1+
name: Publish to PyPI and attach build artifacts to the release
22

33
on:
44
release:
5-
types: [created]
5+
types: [published]
66

77
jobs:
88
pypi-publish:
9-
name: Publish release to PyPI
9+
name: Build, publish to PyPI, attach to release
1010
runs-on: ubuntu-latest
1111
environment:
1212
name: pypi
1313
url: https://pypi.org/p/testingbotclient
1414
permissions:
15-
id-token: write
15+
id-token: write # OIDC trusted publishing to PyPI
16+
contents: write # upload built artifacts to the GitHub release
1617
steps:
1718
- uses: actions/checkout@v4
1819
- name: Set up Python
@@ -25,3 +26,7 @@ jobs:
2526
run: python -m build
2627
- name: Publish package distributions to PyPI
2728
uses: pypa/gh-action-pypi-publish@release/v1
29+
- name: Attach distributions to the GitHub release
30+
run: gh release upload "${{ github.event.release.tag_name }}" dist/*.whl dist/*.tar.gz --clobber
31+
env:
32+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)