From 0d1f97b6bd306fdc4028271347bc8aa7d0668a89 Mon Sep 17 00:00:00 2001 From: Steve Taylor Date: Tue, 8 Feb 2022 12:18:16 -0700 Subject: [PATCH] Add github action to publish to pypi --- .github/workflows/publish-to-pypi.yml | 37 +++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/publish-to-pypi.yml diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 00000000..7978059b --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,37 @@ +name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI +on: [release] + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + runs-on: ubuntu-18.04 + strategy: + matrix: + python-version: [3.8] + + steps: + - uses: actions/checkout@master + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install pypa/build + run: python -m pip install setuptools build wheel --user + + - name: Build a binary wheel + run: python setup.py sdist bdist_wheel + + - name: Publish any distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: true + + - name: Publish tagged distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.gitignore b/.gitignore index d6602e29..3ce7665d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ build *.egg-info .coverage* .idea/* +/dist