Skip to content

Commit a5ced11

Browse files
committed
Add github action to automatically publish on pypi
1 parent e7ab2eb commit a5ced11

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish to PyPI and GitHub Releases
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.12'
18+
19+
- name: Install build tools
20+
run: pip install build twine
21+
22+
- name: Build package
23+
run: python -m build
24+
25+
- name: Publish to PyPI
26+
if: startsWith(github.ref, 'refs/tags/')
27+
uses: pypa/gh-action-pypi-publish@release/v1
28+
with:
29+
user: __token__
30+
password: ${{ secrets.PYPI_API_TOKEN }}
31+
32+
- name: Create GitHub Release
33+
uses: softprops/action-gh-release@v1
34+
with:
35+
files: dist/*
36+
generate_release_notes: true

0 commit comments

Comments
 (0)