Skip to content

hot-fix for pypi minor release pub error #5

hot-fix for pypi minor release pub error

hot-fix for pypi minor release pub error #5

Workflow file for this run

name: publish-python
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
build:
name: build-sdist-wheel
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build package
run: |
python -m pip install --upgrade pip build twine
rm -rf dist build *.egg-info
python -m build
python -m twine check dist/*
- name: Verify built artifact versions
run: |
python - <<'PY'
from pathlib import Path
import tomllib
version = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]["version"]
dist = sorted(Path("dist").glob("*"))
if not dist:
raise SystemExit("No build artifacts found in dist/")
names = [path.name for path in dist]
expected = {
f"vcf_rdfizer-{version}.tar.gz",
f"vcf_rdfizer-{version}-py3-none-any.whl",
}
missing = sorted(expected.difference(names))
if missing:
raise SystemExit(
f"Built artifacts do not match project version {version}; missing: {', '.join(missing)}"
)
unexpected = sorted(
name for name in names if name.startswith("vcf_rdfizer-") and f"vcf_rdfizer-{version}" not in name
)
if unexpected:
raise SystemExit(
f"Found stale artifacts in dist/: {', '.join(unexpected)}"
)
print("Verified build artifacts:")
for name in names:
print(f" {name}")
PY
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-dist
path: dist/*
publish:
name: publish-to-pypi
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
permissions:
id-token: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: python-dist
path: dist
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1