Skip to content

Commit cd18ee2

Browse files
committed
ci: Add release job pushing to TestPyPI
1 parent dd6d3c1 commit cd18ee2

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release (TestPyPI)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
# Matches ci.yml: bash everywhere keeps the make recipes portable across the runner images.
10+
defaults:
11+
run:
12+
shell: bash
13+
14+
jobs:
15+
release:
16+
name: Publish to TestPyPI
17+
runs-on: ubuntu-latest
18+
timeout-minutes: 15
19+
permissions:
20+
contents: read
21+
# OIDC token for PyPI trusted publishing, scoped to this job so nothing else in the
22+
# workflow can mint one. Job-level permissions replace the workflow-level block outright,
23+
# so contents: read has to be repeated here for the checkout.
24+
id-token: write
25+
steps:
26+
- uses: actions/checkout@v5
27+
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v6
30+
with:
31+
enable-cache: true
32+
33+
# The same target CI and the pre-push hook run, so the release path cannot drift from the
34+
# checks: it builds into dist/, validates the metadata with twine, and imports the wheel in
35+
# a throwaway environment. It leaves dist/ in place, which is what gets published below.
36+
- run: make dist-check
37+
38+
# No username, password or token: the TestPyPI trusted publisher is matched on this
39+
# repository and on this workflow's filename, so renaming this file breaks publishing.
40+
#
41+
# Deliberately no skip-existing. A version already present on the index should fail the run
42+
# loudly rather than pass as a no-op, because neither index allows a version to be
43+
# re-uploaded once taken -- the fix is always a new version, never a retry.
44+
- name: Publish to TestPyPI
45+
uses: pypa/gh-action-pypi-publish@release/v1
46+
with:
47+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)