gci: Limit PyPI publication to pull request merged and version tags

This commit is contained in:
Christian Decker 2021-09-23 15:48:02 +02:00
parent 478c43cd9c
commit 0e987e5ef5

View file

@ -1,6 +1,10 @@
--- ---
name: Publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI 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: jobs:
deploy: deploy:
name: Build and publish ${{ matrix.package }} 🐍 name: Build and publish ${{ matrix.package }} 🐍
@ -46,6 +50,7 @@ jobs:
python -m build --sdist --wheel --outdir dist/ . python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution πŸ“¦ to Test PyPI - name: Publish distribution πŸ“¦ to Test PyPI
if: github.repository == β€˜ElementsProject/lightning’
uses: pypa/gh-action-pypi-publish@master uses: pypa/gh-action-pypi-publish@master
env: env:
WORKDIR: ${{ matrix.WORKDIR }} WORKDIR: ${{ matrix.WORKDIR }}
@ -56,7 +61,7 @@ jobs:
skip_existing: true skip_existing: true
- name: Publish distribution πŸ“¦ to PyPI - 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 uses: pypa/gh-action-pypi-publish@master
env: env:
WORKDIR: ${{ matrix.WORKDIR }} WORKDIR: ${{ matrix.WORKDIR }}