Skip to content

Commit

Permalink
publish to pypi on github release
Browse files Browse the repository at this point in the history
  • Loading branch information
willforde committed Nov 2, 2022
1 parent ad852c1 commit ba108d0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish to PyPi

on:
release:
types: [published]

jobs:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install dependencies
run: |
python3 -m pip install --upgrade build
python3 -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
15 changes: 0 additions & 15 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install test dependencies
run: |
python -m pip install --upgrade --no-cache-dir pip
pip install --no-cache-dir flake8
- name: Test linting with flake8
run: flake8 --max-line-length=127

publish:
runs-on: ubuntu-latest
needs: [tests, linting]
steps:
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit ba108d0

Please sign in to comment.