Skip to content

Commit 217e2e9

Browse files
committed
chore: Add publish step
1 parent 7cc67ba commit 217e2e9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI
2+
on: push
3+
jobs:
4+
build-n-publish:
5+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@master
9+
- name: Set up Python 3.10
10+
uses: actions/setup-python@v3
11+
with:
12+
python-version: "3.10"
13+
- name: Setup pandoc for changelog conversion
14+
run: sudo apt update && apt install -y pandoc
15+
- name: Write pypi's readme
16+
run: |
17+
cat README.rst > to-pypi.rst
18+
echo "" >> to-pypi.rst
19+
pandoc -s --to rst -o /dev/stdout CHANGELOG.md | tee -a to-pypi.rst
20+
mv to-pypi.rst README.rst
21+
- name: Install pypa/build
22+
run: >-
23+
python -m
24+
pip install
25+
build
26+
--user
27+
- name: Build a binary wheel and a source tarball
28+
run: >-
29+
python -m
30+
build
31+
--sdist
32+
--wheel
33+
--outdir dist/
34+
.
35+
- name: Publish distribution 📦 to PyPI
36+
if: startsWith(github.ref, 'refs/tags')
37+
uses: pypa/gh-action-pypi-publish@release/v1
38+
with:
39+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)