Skip to content

Commit

Permalink
Only run the workflow when a new release is tagged
Browse files Browse the repository at this point in the history
  • Loading branch information
sh4nks committed Feb 28, 2021
1 parent eefecdd commit e6eaad1
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions .github/workflows/publish_to_pypi.yml
@@ -1,6 +1,6 @@
name: Publish Python packages to PyPI and TestPyPI

on: push
on: release

jobs:
build-n-publish:
Expand All @@ -15,27 +15,18 @@ jobs:
python-version: 3.9

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
run: python -m pip install build --user

- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
run: python -m build --sdist --wheel --outdir dist/ .

- name: Publish package to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
# Lets test it on TEST_PYPI first
# - name: Publish package to PyPI
# if: startsWith(github.ref, 'refs/tags')
# uses: pypa/gh-action-pypi-publish@master
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish package to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit e6eaad1

Please sign in to comment.