Skip to content

Commit

Permalink
Add github action to release project to pypi on tag
Browse files Browse the repository at this point in the history
  • Loading branch information
autophagy committed Oct 19, 2020
1 parent ac6f6d5 commit 35d24cc
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: release

on: push

jobs:
pypi:
name: Build & publish package to pypi
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@master

- name: Set up python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Build package
run: |
python -m pip install twine wheel
python setup.py sdist bdist_wheel
twine check dist/*.tar.gz
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
35 changes: 2 additions & 33 deletions DEVELOP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,48 +59,17 @@ In the release branch:

- Push to origin/<release_branch>

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

On master:

- Update the release notes to reflect the release

Next:

- Deploy to PyPI (see section below)

- Archive docs for old releases (see section below)

PyPI Deployment
---------------

To create the package use::

$ bin/py setup.py sdist bdist_wheel

Then, use twine_ to upload the package to PyPI_::

$ bin/twine upload dist/*

For this to work, you will need a personal PyPI account that is set up as a project admin.

You'll also need to create a ``~/.pypirc`` file, like so::

[distutils]
index-servers =
pypi

[pypi]
repository=https://pypi.python.org/pypi
username=<USERNAME>
password=<PASSWORD>

Here, ``<USERNAME>`` and ``<PASSWORD>`` should be replaced with your username and password, respectively.

If you want to check the PyPI description before uploading, run::

$ bin/py setup.py check --strict --restructuredtext

Archiving Docs Versions
-----------------------

Expand Down

0 comments on commit 35d24cc

Please sign in to comment.