File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Release (TestPyPI)
2+
3+ on :
4+ # Manual run for quick testing
5+ workflow_dispatch :
6+ # Optional: run on tags like v0.1.0
7+ push :
8+ tags : ["v*"]
9+
10+ jobs :
11+ publish :
12+ runs-on : ubuntu-latest
13+ permissions :
14+ id-token : write
15+ contents : read
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - uses : actions/setup-python@v5
20+ with :
21+ python-version : " 3.11"
22+
23+ - uses : astral-sh/setup-uv@v3
24+
25+ - name : Install deps
26+ run : uv sync --all-extras --dev
27+
28+ - name : Build dists
29+ run : uv run python -m build
30+
31+ - name : Verify tag matches version (only on tag)
32+ if : startsWith(github.ref, 'refs/tags/')
33+ id : get_tag
34+ shell : bash
35+ run : |
36+ TAG="${GITHUB_REF_NAME#v}"
37+ echo "result_tag=$TAG" >> "$GITHUB_OUTPUT"
38+ python - <<'PY'
39+ import sys, tomllib
40+ with open('pyproject.toml', 'rb') as f:
41+ data = tomllib.load(f)
42+ ver = data['project']['version']
43+ if ver != sys.argv[1]:
44+ print(f"Version {ver} != tag {sys.argv[1]}")
45+ raise SystemExit(1)
46+ PY
47+ "$TAG"
48+
49+ - name : Publish distribution 📦 to TestPyPI (OIDC)
50+ uses : pypa/gh-action-pypi-publish@release/v1
51+ with :
52+ repository-url : https://test.pypi.org/legacy/
53+ verbose : true
You can’t perform that action at this time.
0 commit comments