Move if-clause of PyPI upload to job level rather than action level, and specify to use only published releases
This commit is contained in:
@@ -1,6 +1,11 @@
|
|||||||
name: Build and upload to PyPI
|
name: Build and upload to PyPI
|
||||||
|
|
||||||
on: [push, pull_request, release]
|
on:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
- release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_wheels:
|
build_wheels:
|
||||||
@@ -56,7 +61,11 @@ jobs:
|
|||||||
upload_pypi:
|
upload_pypi:
|
||||||
needs: [build_wheels, build_sdist]
|
needs: [build_wheels, build_sdist]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
# upload to PyPI on every tag starting with 'v'
|
||||||
|
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
|
||||||
|
# alternatively, to publish when a GitHub Release is created, use the following rule:
|
||||||
|
# if: github.event_name == 'release' && github.event.action == 'published'
|
||||||
|
steps:
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: artifact
|
name: artifact
|
||||||
@@ -67,7 +76,3 @@ jobs:
|
|||||||
user: __token__
|
user: __token__
|
||||||
password: ${{ secrets.pypi_password }}
|
password: ${{ secrets.pypi_password }}
|
||||||
# To test: repository_url: https://test.pypi.org/legacy/
|
# To test: repository_url: https://test.pypi.org/legacy/
|
||||||
# upload to PyPI on every tag starting with 'v'
|
|
||||||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
|
|
||||||
# alternatively, to publish when a GitHub Release is created, use the following rule:
|
|
||||||
# if: github.event_name == 'release' && github.event.action == 'published'
|
|
||||||
|
|||||||
Reference in New Issue
Block a user