Skip to content

Commit

Permalink
Add script to automate release to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
RemiLehe committed Jan 3, 2024
1 parent 1a3095b commit 7be7fad
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish package to PyPI

on:
release:
types: [created]

jobs:
build-n-publish:
name: Build and publish package to PyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python3 -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish package distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
10 changes: 1 addition & 9 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,4 @@ username = <yourPypiUsername>

## Uploading the package to PyPI

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

0 comments on commit 7be7fad

Please sign in to comment.