-
Notifications
You must be signed in to change notification settings - Fork 18
76 lines (69 loc) · 2.41 KB
/
Copy pathpublish-to-test-pypi.yml
File metadata and controls
76 lines (69 loc) · 2.41 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
69
70
71
72
73
74
75
76
name: Publish 📦 to PyPI test server 🐍
on:
workflow_dispatch:
permissions:
contents: read
jobs:
metadata:
name: Release Metadata
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.version.outputs.package_version }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Read package version
id: version
run: |
python3 - <<'PY'
import os
import tomllib
from pathlib import Path
version = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]["version"]
with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as fh:
fh.write(f"package_version={version}\n")
print(version)
PY
verify:
name: Verify TestPyPI Candidate
uses: ./.github/workflows/ci.yml
build:
name: Build TestPyPI Release (${{ needs.metadata.outputs.package_version }})
runs-on: ubuntu-latest
needs: [metadata, verify]
permissions:
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.13"
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0
- name: Sync dependencies
run: make sync
- name: Build package
run: make build
- name: Upload distribution artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dist-${{ needs.metadata.outputs.package_version }}
path: dist/*
if-no-files-found: error
publish:
name: Publish TestPyPI Release (${{ needs.metadata.outputs.package_version }})
runs-on: ubuntu-latest
needs: [metadata, build]
permissions:
contents: read
id-token: write
environment: testpypi
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: dist-${{ needs.metadata.outputs.package_version }}
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@106e0b0b7c337fa67ed433972f777c6357f78598 # v1.13.0
with:
packages-dir: dist
repository-url: https://test.pypi.org/legacy/