Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions {{ cookiecutter.directory_name }}/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,17 @@ jobs:
- run: python -m pip install tox
- run: tox -e py

check-build:
name: Build and check Python package
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "3.x"
- name: "Install packaging tools"
run: "python -m pip install --upgrade build twine"
- name: "Build dist package"
run: "python -m build"
- name: "Run twine checks"
run: "python -m twine check dist/*"
28 changes: 28 additions & 0 deletions {{ cookiecutter.directory_name }}/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# See also https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

name: "Build and upload to PyPI"
on:
release:
types: ["published"]

jobs:
build:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"

Copy link
Contributor

Choose a reason for hiding this comment

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

nitty nit: We've got difference whitespace styles here and in ci.yml. As a template I'd prefer it if we were consistent.

- uses: "actions/setup-python@v2"
with:
python-version: "3.x"
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the Python version matter here? I suppose not.


- name: "Install packaging tools"
run: "python -m pip install --upgrade build twine"

- name: "Build dist package"
run: "python -m build"

- name: "Upload to PyPI"
run: "python -m twine upload dist/*"
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: "${{ secrets.PYPI_API_TOKEN }}"