Skip to content

Commit 98e3af2

Browse files
fix(publish): OIDC trusted publisher + workflow_dispatch inputs + v6 actions
1 parent 93f6519 commit 98e3af2

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ on:
44
release:
55
types: [published]
66
workflow_dispatch:
7+
inputs:
8+
pypi_target:
9+
description: 'PyPI target (pypi or testpypi)'
10+
default: 'pypi'
11+
type: choice
12+
options:
13+
- pypi
14+
- testpypi
715

816
jobs:
917
publish:
@@ -13,10 +21,10 @@ jobs:
1321
id-token: write
1422

1523
steps:
16-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v6
1725

18-
- name: Set up Python
19-
uses: actions/setup-python@v5
26+
- name: Set up Python 3.11
27+
uses: actions/setup-python@v6
2028
with:
2129
python-version: "3.12"
2230

@@ -31,5 +39,12 @@ jobs:
3139
- name: Check package
3240
run: twine check dist/*
3341

42+
- name: Publish to TestPyPI
43+
if: ${{ inputs.pypi_target == 'testpypi' }}
44+
uses: pypa/gh-action-pypi-publish@release/v1
45+
with:
46+
repository-url: https://test.pypi.org/legacy/
47+
3448
- name: Publish to PyPI
49+
if: ${{ inputs.pypi_target == 'pypi' || github.event_name == 'release' }}
3550
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)