Skip to content

Commit 82fa922

Browse files
committed
add indexes for publishing
1 parent 91da7c3 commit 82fa922

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

.github/actions/publish/action.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ inputs:
99
description: Python version
1010
required: false
1111
default: "3.13"
12+
PUBLISH_INDEX:
13+
description: Named index from pyproject.toml to publish to (pypi or test-pypi)
14+
required: false
15+
default: "pypi"
1216
PYPI_TOKEN:
1317
description: PyPI API token.
1418
required: true
@@ -39,5 +43,5 @@ runs:
3943
shell: bash
4044

4145
- name: Publish to PyPI
42-
run: uv publish --token "${{ inputs.PYPI_TOKEN }}"
46+
run: uv publish --index "${{ inputs.PUBLISH_INDEX }}" --token "${{ inputs.PYPI_TOKEN }}"
4347
shell: bash

.github/workflows/release.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ jobs:
2323
- name: Publish to PyPI Test
2424
uses: ./.github/actions/publish
2525
with:
26-
PYPI_REGISTRY: https://test.pypi.org/legacy/
26+
PUBLISH_INDEX: test-pypi
2727
PYPI_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }}
2828
- name: Publish to PyPI
2929
uses: ./.github/actions/publish
3030
with:
31-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
31+
PUBLISH_INDEX: pypi
32+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,15 @@ show_missing = true
130130

131131
[tool.coverage.html]
132132
directory = "htmlcov"
133+
134+
[tool.uv.publish]
135+
# Define named indexes for publishing
136+
[[tool.uv.publish.index]]
137+
name = "pypi"
138+
url = "https://upload.pypi.org/legacy/"
139+
explicit = true
140+
141+
[[tool.uv.publish.index]]
142+
name = "test-pypi"
143+
url = "https://test.pypi.org/legacy/"
144+
explicit = true

0 commit comments

Comments
 (0)