Skip to content

Commit 6f5c01e

Browse files
committed
ci: publish to PyPI on every successful CI run
1 parent 9a23a30 commit 6f5c01e

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Publish to PyPI
22

33
on:
4+
# Trigger after CI workflow completes successfully on master/main
5+
workflow_run:
6+
workflows: ["CI"]
7+
types: [completed]
8+
branches: [master, main]
9+
# Also support manual tag-based releases
410
release:
511
types: [published]
612
push:
@@ -10,8 +16,15 @@ on:
1016
jobs:
1117
build:
1218
runs-on: ubuntu-latest
19+
# Only run if CI succeeded (for workflow_run trigger) or for tags/releases
20+
if: |
21+
github.event_name == 'release' ||
22+
github.event_name == 'push' ||
23+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
1324
steps:
1425
- uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.event.workflow_run.head_sha || github.sha }}
1528

1629
- name: Install uv
1730
uses: astral-sh/setup-uv@v4
@@ -56,7 +69,11 @@ jobs:
5669
publish-pypi:
5770
runs-on: ubuntu-latest
5871
needs: [build]
59-
if: github.event_name == 'release'
72+
# Publish on: releases, tag pushes, or successful CI on master/main
73+
if: |
74+
github.event_name == 'release' ||
75+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) ||
76+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
6077
environment:
6178
name: pypi
6279
url: https://pypi.org/p/klondike-spec-cli
@@ -70,3 +87,5 @@ jobs:
7087

7188
- name: Publish to PyPI
7289
uses: pypa/gh-action-pypi-publish@release/v1
90+
with:
91+
skip-existing: true

0 commit comments

Comments
 (0)