File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 - name : Build package
2323 run : |
2424 python -m pip install --upgrade pip build twine
25+ rm -rf dist build *.egg-info
2526 python -m build
2627 python -m twine check dist/*
2728
29+ - name : Verify built artifact versions
30+ run : |
31+ python - <<'PY'
32+ from pathlib import Path
33+ import tomllib
34+
35+ version = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]["version"]
36+ dist = sorted(Path("dist").glob("*"))
37+ if not dist:
38+ raise SystemExit("No build artifacts found in dist/")
39+
40+ names = [path.name for path in dist]
41+ expected = {
42+ f"vcf_rdfizer-{version}.tar.gz",
43+ f"vcf_rdfizer-{version}-py3-none-any.whl",
44+ }
45+ missing = sorted(expected.difference(names))
46+ if missing:
47+ raise SystemExit(
48+ f"Built artifacts do not match project version {version}; missing: {', '.join(missing)}"
49+ )
50+
51+ unexpected = sorted(
52+ name for name in names if name.startswith("vcf_rdfizer-") and f"vcf_rdfizer-{version}" not in name
53+ )
54+ if unexpected:
55+ raise SystemExit(
56+ f"Found stale artifacts in dist/: {', '.join(unexpected)}"
57+ )
58+
59+ print("Verified build artifacts:")
60+ for name in names:
61+ print(f" {name}")
62+ PY
63+
2864 - name : Upload artifacts
2965 uses : actions/upload-artifact@v4
3066 with :
Original file line number Diff line number Diff line change @@ -133,6 +133,10 @@ def main() -> int:
133133 print (f" git tag -a { tag } -m \" VCF-RDFizer { tag } \" " )
134134 print (" git push origin main" )
135135 print (f" git push origin { tag } " )
136+ print (" # Before building locally for upload, clean old artifacts:" )
137+ print (" rm -rf dist build *.egg-info" )
138+ print (" python -m build" )
139+ print (" python -m twine check dist/*" )
136140
137141 return 0
138142
You can’t perform that action at this time.
0 commit comments