Skip to content

Commit c72c34a

Browse files
committed
Add GitHub Action for PyPI releases
1 parent 7c957ad commit c72c34a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/pypi-release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "PyPI releases"
2+
3+
on: release
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build_sdist:
10+
name: Build Python source distribution
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Build sdist
16+
run: pipx run build --sdist
17+
18+
- uses: actions/upload-artifact@v4
19+
with:
20+
path: dist/*.tar.gz
21+
22+
pypi-publish:
23+
name: Upload release to PyPI
24+
if: github.event_name == 'release' && github.event.action == 'published'
25+
needs:
26+
- build_sdist
27+
runs-on: ubuntu-latest
28+
environment:
29+
name: release
30+
url: https://pypi.org/p/django-tabular-export
31+
permissions:
32+
id-token: write
33+
steps:
34+
- uses: actions/download-artifact@v4
35+
with:
36+
name: artifact
37+
path: dist
38+
- name: Publish package distributions to PyPI
39+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)