Skip to content

Commit

Permalink
Add "publish" CI workflow; adjust doc/releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeru committed Feb 7, 2021
1 parent 8cc0c51 commit 20b0db3
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 31 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,3 @@ jobs:
# Also install packages that provide type hints
pip install mypy ixmp pytest xarray
mypy .
- name: Test package build
run: |
pip install twine wheel
python3 setup.py bdist_wheel sdist
twine check dist/*
50 changes: 50 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: publish

on:
push:
branches: [ master ]
release:
types: [ published ]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
with:
# This should match the "Latest version testable on GitHub Actions"
# in pytest.yml
python-version: "3.8"

- name: Cache Python packages
uses: actions/cache@v2
with:
path: |
~/.cache/pip
key: publish-${{ runner.os }}

- name: Upgrade pip, wheel, setuptools-scm
run: python -m pip install --upgrade pip wheel setuptools-scm twine

- name: Build package
run: |
python3 setup.py bdist_wheel sdist
twine check dist/*
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@master
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
if: github.event_name == 'release'
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
40 changes: 15 additions & 25 deletions doc/releasing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,27 @@ Address any failures before releasing.
Comment the heading "Next release", then insert another heading below it, at the same level, with the version number and date.
Make a commit with a message like "Mark vX.Y.Z in whatsnew.rst".

2. Tag the version, e.g.::
2. Tag the release candidate version, i.e. with a ``rcN`` suffix, and push::

$ git tag v1.2.3b4

3. Test-build and check the source and binary packages::

$ rm -rf build dist
$ python setup.py bdist_wheel sdist
$ twine check dist/*

Address any warnings or errors that appear.
If needed, make a new commit and go back to step (2).

4. Upload the packages to the TEST instance of PyPI::

$ twine upload -r testpypi dist/*

5. Check at https://test.pypi.org/project/genno/ that:
$ git tag v1.2.3rc1
$ git push --tags

- The package can be downloaded, installed and run.
- The README is rendered correctly.
- Links to the documentation go to the correct version.
3. Check:

If not, modify the code and go back to step (2).
- at https://github.com/khaeru/genno/actions?query=workflow:publish that the workflow completes: the package builds successfully and is published to TestPyPI.
- at https://test.pypi.org/project/genno/ that:

6. Upload to PyPI::
- The package can be downloaded, installed and run.
- The README is rendered correctly.

$ twine upload dist/*
Address any warnings or errors that appear.
If needed, make a new commit and go back to step (2), incrementing the rc number.

7. Push the commits and tag to GitHub::
4. Tag the release itself and push::

$ git tag v1.2.3
$ git push --tags

Visit https://github.com/khaeru/genno/releases and mark the new release using the pushed tag.
5. Visit https://github.com/khaeru/genno/releases and mark the new release using the pushed tag.

6. Check at https://github.com/khaeru/genno/actions?query=workflow:publish and https://pypi.org/project/genno/ that the distributions are published.

0 comments on commit 20b0db3

Please sign in to comment.