Streamline deployment workflow

This commit is contained in:
Hynek Schlawack 2022-12-19 16:06:37 +01:00
parent d4090f4706
commit ae4324df88
No known key found for this signature in database
GPG Key ID: AE2536227F69F181
1 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,5 @@
--- ---
name: Build & push package to (Test-) PyPI name: Deploy to (Test-) PyPI
on: on:
push: push:
@ -7,16 +7,16 @@ on:
release: release:
types: types:
- published - published
workflow_dispatch:
permissions: permissions:
contents: read contents: read
jobs: jobs:
release-test-pypi: release-test-pypi:
# Upload to Test PyPI on every pushed tag.
environment: release-test-pypi environment: release-test-pypi
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps: steps:
- name: Harden Runner - name: Harden Runner
@ -40,17 +40,17 @@ jobs:
python -m build python -m build
twine check --strict dist/* twine check --strict dist/*
# Upload to Test PyPI on every pushed tag. - name: Publish package to Test PyPI
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }} password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/ repository_url: https://test.pypi.org/legacy/
release-pypi: release-pypi:
# Upload to real PyPI on GitHub Releases.
environment: release-pypi environment: release-pypi
runs-on: ubuntu-latest
if: github.event.action == 'published' if: github.event.action == 'published'
runs-on: ubuntu-latest
steps: steps:
- name: Harden Runner - name: Harden Runner
@ -72,7 +72,6 @@ jobs:
python -m build python -m build
twine check --strict dist/* twine check --strict dist/*
# Upload to real PyPI on GitHub Releases.
- name: Publish package to PyPI - name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with: