Skip to content

Commit 5ea837c

Browse files
Chris1221claude
andcommitted
ci: make python-publish a reusable workflow called from release-please
Keeps publish logic in python-publish.yml so the PyPI trusted publisher config (which matches on job_workflow_ref) remains valid. release-please calls it via workflow_call when a release is created, avoiding the GITHUB_TOKEN cross-workflow trigger limitation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 772dad4 commit 5ea837c

2 files changed

Lines changed: 5 additions & 30 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# This workflow will upload a Python Package to PyPI when a release is created by release-please
1+
# This workflow uploads a Python package to PyPI. It is called by release-please.yml
2+
# when a new release is created.
23
name: Publish to PyPI
34

45
on:
5-
push:
6-
tags:
7-
- 'v*'
8-
9-
permissions:
10-
contents: read
6+
workflow_call:
117

128
jobs:
139
pypi-publish:
@@ -16,7 +12,7 @@ jobs:
1612
name: pypi
1713
url: https://pypi.org/p/yamldoc
1814
permissions:
19-
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
15+
id-token: write
2016

2117
steps:
2218
- uses: actions/checkout@v4

.github/workflows/release-please.yml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
runs-on: ubuntu-latest
1616
outputs:
1717
release_created: ${{ steps.release.outputs.release_created }}
18-
tag_name: ${{ steps.release.outputs.tag_name }}
1918
steps:
2019
- uses: google-github-actions/release-please-action@v4
2120
id: release
@@ -26,26 +25,6 @@ jobs:
2625
publish:
2726
needs: release-please
2827
if: ${{ needs.release-please.outputs.release_created }}
29-
runs-on: ubuntu-latest
30-
environment:
31-
name: pypi
32-
url: https://pypi.org/p/yamldoc
28+
uses: ./.github/workflows/python-publish.yml
3329
permissions:
3430
id-token: write
35-
36-
steps:
37-
- uses: actions/checkout@v4
38-
39-
- name: Install Pixi
40-
run: |
41-
curl -fsSL https://pixi.sh/install.sh | bash
42-
echo "$HOME/.pixi/bin" >> $GITHUB_PATH
43-
44-
- name: Install dependencies
45-
run: pixi install
46-
47-
- name: Build package
48-
run: pixi run python -m build
49-
50-
- name: Publish package to PyPI
51-
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)