Skip to content

Commit 01b6426

Browse files
authored
Merge pull request #413 from RemiLehe/publish-to-pypi
Add script to automate release to PyPI
2 parents 9311067 + 7be7fad commit 01b6426

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

.github/workflows/publish-to-pypi.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish package to PyPI
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build-n-publish:
9+
name: Build and publish package to PyPI
10+
runs-on: ubuntu-latest
11+
permissions:
12+
# IMPORTANT: this permission is mandatory for trusted publishing
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python 3.11
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: 3.11
20+
- name: Install pypa/build
21+
run: >-
22+
python3 -m
23+
pip install
24+
build
25+
--user
26+
- name: Build a binary wheel and a source tarball
27+
run: >-
28+
python3 -m
29+
build
30+
--sdist
31+
--wheel
32+
--outdir dist/
33+
.
34+
- name: Publish package distribution to PyPI
35+
uses: pypa/gh-action-pypi-publish@release/v1

RELEASING.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,4 @@ username = <yourPypiUsername>
4040

4141
## Uploading the package to PyPI
4242

43-
- Upload the package to [PyPI](https://pypi.python.org/pypi):
44-
```
45-
rm -rf dist
46-
python setup.py sdist bdist_wheel
47-
twine upload dist/* -r pypi
48-
```
49-
(NB: You can also first test this by uploading the package to
50-
[test PyPI](https://testpypi.python.org/pypi) ; to do so, simply
51-
replace `pypi` by `pypitest` in the above set of commands)
43+
The code will be automatically uploaded to PyPI upon creation of a new release on Github.

0 commit comments

Comments
 (0)