Skip to content

Commit 35d24cc

Browse files
committed
Add github action to release project to pypi on tag
1 parent ac6f6d5 commit 35d24cc

File tree

2 files changed

+31
-33
lines changed

2 files changed

+31
-33
lines changed

.github/workflows/release.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: release
3+
4+
on: push
5+
6+
jobs:
7+
pypi:
8+
name: Build & publish package to pypi
9+
runs-on: ubuntu-latest
10+
if: startsWith(github.event.ref, 'refs/tags')
11+
steps:
12+
- uses: actions/checkout@master
13+
14+
- name: Set up python 3.8
15+
uses: actions/setup-python@v1
16+
with:
17+
python-version: 3.8
18+
19+
- name: Build package
20+
run: |
21+
python -m pip install twine wheel
22+
python setup.py sdist bdist_wheel
23+
twine check dist/*.tar.gz
24+
25+
- name: Publish package
26+
uses: pypa/gh-action-pypi-publish@master
27+
with:
28+
user: __token__
29+
password: ${{ secrets.pypi_password }}

DEVELOP.rst

+2-33
Original file line numberDiff line numberDiff line change
@@ -59,48 +59,17 @@ In the release branch:
5959

6060
- Push to origin/<release_branch>
6161

62-
- Create a tag by running ``./devtools/create_tag.sh``
62+
- Create a tag by running ``./devtools/create_tag.sh``. This will trigger a
63+
Github action which releases the new version to PyPi.
6364

6465
On master:
6566

6667
- Update the release notes to reflect the release
6768

6869
Next:
6970

70-
- Deploy to PyPI (see section below)
71-
7271
- Archive docs for old releases (see section below)
7372

74-
PyPI Deployment
75-
---------------
76-
77-
To create the package use::
78-
79-
$ bin/py setup.py sdist bdist_wheel
80-
81-
Then, use twine_ to upload the package to PyPI_::
82-
83-
$ bin/twine upload dist/*
84-
85-
For this to work, you will need a personal PyPI account that is set up as a project admin.
86-
87-
You'll also need to create a ``~/.pypirc`` file, like so::
88-
89-
[distutils]
90-
index-servers =
91-
pypi
92-
93-
[pypi]
94-
repository=https://pypi.python.org/pypi
95-
username=<USERNAME>
96-
password=<PASSWORD>
97-
98-
Here, ``<USERNAME>`` and ``<PASSWORD>`` should be replaced with your username and password, respectively.
99-
100-
If you want to check the PyPI description before uploading, run::
101-
102-
$ bin/py setup.py check --strict --restructuredtext
103-
10473
Archiving Docs Versions
10574
-----------------------
10675

0 commit comments

Comments
 (0)