-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (62 loc) · 2.89 KB
/
Copy pathtest-release.yml
File metadata and controls
68 lines (62 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Test release (TestPyPI)
# Manual dry-run of the release packaging path: build the same cibuildwheel
# matrix + sdist as the real release, then publish to TestPyPI. Unlike
# release.yml it has NO side effects — no version bump, no commit/tag, no GitHub
# Release — so it is safe to run repeatedly to verify the build + upload path.
#
# Publishes via TestPyPI Trusted Publishing (OIDC) by default — configure a
# trusted publisher on test.pypi.org for this repo + this workflow filename
# (https://docs.pypi.org/trusted-publishers/). If the TESTPYPI_API_TOKEN secret is
# set instead, the publish action uses that token. Uploads the version currently in
# pyproject.toml with `skip-existing`, so re-runs of the same version are no-ops.
on:
workflow_dispatch:
concurrency:
group: test-release
cancel-in-progress: false
permissions:
contents: read
jobs:
# No token preflight: Trusted Publishing mints the credential per run (and a
# missing publisher / token surfaces at the upload with a clear error). The
# dry-run has no side effects, so there is nothing to gate before the build.
# Build the same wheels matrix + sdist as the real release, via the shared
# reusable workflow. No release-meta overlay: the dry-run packages the version
# currently in pyproject.toml. Uploads `wheels-<os>` + `sdist` for publish.
build_dists:
uses: ./.github/workflows/_build-dists.yml
with:
overlay-release-meta: false
publish_testpypi:
needs: [build_dists]
runs-on: ubuntu-latest
permissions:
contents: read # actions/checkout for the repository-owned toolchain snapshot
id-token: write # TestPyPI Trusted Publishing (OIDC); also enables the token fallback
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Load exact release toolchain snapshot
shell: bash
run: python scripts/release/toolchain.py export-github-env >> "$GITHUB_ENV"
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
- name: Collect built distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: ./dist
pattern: "{wheels-*,sdist}"
merge-multiple: true
- name: Check metadata
# Same snapshot as release.yml's pre-pivot check, so the dry-run mirrors it.
run: uvx "twine==${TWINE_VERSION}" check --strict ./dist/*
# OIDC by default (no TESTPYPI_API_TOKEN set); the token is used if present.
- name: Upload to TestPyPI
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist
skip-existing: true
password: ${{ secrets.TESTPYPI_API_TOKEN }}