Skip to content

Commit

Permalink
Only attempt to run publishing workflow if tests succeed.
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtraschke committed Nov 7, 2024
1 parent 075bb76 commit 5fc25a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push
on:
workflow_run:
workflows: ['Tests']
types: [completed]

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')}}

steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -34,7 +39,7 @@ jobs:
publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes, of tags whose names start with 'v'
needs:
- build
runs-on: ubuntu-latest
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: tests
name: Tests
on:
workflow_dispatch:
push:
branches: ["master"]
tags-ignore: ["**"]
pull_request:

concurrency:
Expand Down

0 comments on commit 5fc25a0

Please sign in to comment.