From 0e987e5ef5b9fcee4c4e60bec738284ee150c79a Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 23 Sep 2021 15:48:02 +0200 Subject: [PATCH] gci: Limit PyPI publication to pull request merged and version tags --- .github/workflows/pypi.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 018b9acde..b49ca9f04 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -1,6 +1,10 @@ --- name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI -on: push +on: + # Only deploy if we're the result of a PR being merged + push: + branches: + - master jobs: deploy: name: Build and publish ${{ matrix.package }} 🐍 @@ -46,6 +50,7 @@ jobs: python -m build --sdist --wheel --outdir dist/ . - name: Publish distribution 📦 to Test PyPI + if: github.repository == ‘ElementsProject/lightning’ uses: pypa/gh-action-pypi-publish@master env: WORKDIR: ${{ matrix.WORKDIR }} @@ -56,7 +61,7 @@ jobs: skip_existing: true - name: Publish distribution 📦 to PyPI - if: startsWith(github.ref, 'refs/tags') + if: startsWith(github.ref, 'refs/tags') && github.repository == ‘ElementsProject/lightning’ uses: pypa/gh-action-pypi-publish@master env: WORKDIR: ${{ matrix.WORKDIR }}