Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to publish on PyPI #139

Merged
merged 7 commits into from Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,43 @@
name: Release

on:
push:

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
if: github.repository == 'astropy/pytest-doctestplus'

steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install python-build and twine
run: python -m pip install build twine
pllim marked this conversation as resolved.
Show resolved Hide resolved

- name: Build package
run: python -m build --sdist --wheel .

- name: List result
run: ls -l dist

- name: Check long_description
run: python -m twine check dist/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want the publish to not happen if there are warnings, it has to be strict.

Suggested change
run: python -m twine check dist/*
run: python -m twine check dist/* --strict

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there is warning about "long description type", not sure if we want to fail for this ? Oh, and I don't see --strict in twine check's help ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, funny:

❯ twine check --help
usage: twine check [-h] dist [dist ...]

positional arguments:
  dist        The distribution files to check, usually dist/*

optional arguments:
  -h, --help  show this help message and exit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah... Maybe pypa/twine#715 is not released yet. It is milestoned to 3.3.0 and current release is 3.2.0.


- name: Test package
run: |
cd ..
python -m venv testenv
testenv/bin/pip install pytest pytest-doctestplus/dist/*.whl
testenv/bin/pytest pytest-doctestplus/tests --doctest-plus --doctest-rst

- name: Publish distribution 📦 to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
saimn marked this conversation as resolved.
Show resolved Hide resolved
with:
password: ${{ secrets.pypi_password }}
1 change: 1 addition & 0 deletions setup.cfg
Expand Up @@ -21,6 +21,7 @@ classifiers =
license = BSD
description = Pytest plugin with advanced doctest features.
long_description = file: README.rst
long_description_content_type = text/x-rst
keywords = doctest, rst, pytest, py.test

[options]
Expand Down