Skip to content

Commit

Permalink
Add github action to build and deploy to pypi
Browse files Browse the repository at this point in the history
* on push to develop branch, build, but don't deploy,
* on tag push, build and deploy
  • Loading branch information
LincolnPuzey committed Jan 22, 2022
1 parent b788153 commit 1da1863
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
35 changes: 35 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Publish to PyPI"

on:
push:
branches:
- 'develop'
tags:
- '*'

jobs:
build-and-publish:
name: Build and publish Python distributions to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install pypa/build
run: |
python -m pip install --upgrade pip wheel
pip install build
pip list
- name: Build a binary wheel and a source tarball
run: python -m build

- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools >= 47.0.0", "wheel"]
requires = ["setuptools ~= 60.5", "wheel"]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
Expand Down

0 comments on commit 1da1863

Please sign in to comment.