Skip to content

Commit

Permalink
✨ add workflow for PyPI releases (based on GitHub releases)
Browse files Browse the repository at this point in the history
- github release tags a commit, but the action is triggered only by the publishing event of a release
  • Loading branch information
enryH committed Sep 2, 2024
1 parent c534c7e commit 4831611
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/tox-gha.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Python package

on:
- push
- pull_request
push:
pull_request:
release:
types: [published]

jobs:
build:
Expand All @@ -22,3 +24,27 @@ jobs:
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox


publish:
name: Publish package
if: startsWith(github.ref, 'refs/tags')
needs:
- build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install twine and build
run: python -m pip install --upgrade twine build
- name: Build
run: python -m build

- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 4831611

Please sign in to comment.