Skip to content

Commit

Permalink
MAINT: Move pypi publish to dedicated workflow (#1878)
Browse files Browse the repository at this point in the history
  • Loading branch information
choldgraf committed Nov 23, 2022
1 parent 795c4b5 commit d162650
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,32 @@
# This will run every time a tag is created and pushed to the repository.
# It calls our tests workflow via a `workflow_call`, and if tests pass
# then it triggers our upload to PyPI for a new release.
name: Publish to PyPI
on:
release:
types: ["published"]

jobs:
tests:
uses: ./.github/workflows/tests.yml
publish:
name: publish
needs: [tests] # require tests to pass before deploy runs
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install flit
run: |
pip install flit~=3.6
- name: Build and publish
run: |
flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}
25 changes: 1 addition & 24 deletions .github/workflows/tests.yml
Expand Up @@ -6,6 +6,7 @@ on:
tags:
- 'v*'
pull_request:
workflow_call:

env:
# Force colors for logs
Expand Down Expand Up @@ -109,27 +110,3 @@ jobs:
- name: Run pytest
run: pytest --durations=10 -m 'not requires_tex'

publish:

name: Publish to PyPi
needs: [pre-commit, test-with-cov, tests]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install flit
run: |
pip install flit~=3.6
- name: Build and publish
run: |
flit publish
env:
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_KEY }}

0 comments on commit d162650

Please sign in to comment.