Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Python Publish (pypi)

on:
release:
types: [created]
Expand All @@ -13,11 +14,13 @@ jobs:
name: Upload release to PyPI
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/graphrag

permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

steps:
- uses: actions/checkout@v4
Expand All @@ -44,6 +47,57 @@ jobs:
shell: bash
run: uv build

- name: Inspect all distribution members and metadata
shell: bash
run: |
python - <<'PY'
import glob, zipfile, tarfile, re

print("\n=== FILES IN dist/ ===")
for f in glob.glob("dist/*"):
print(" ", f)

print("\n=== WHEELS ===")
for whl in glob.glob("dist/*.whl"):
print("\n---", whl, "---")
with zipfile.ZipFile(whl) as z:
for name in z.namelist():
print(name)

metas = [n for n in z.namelist() if n.endswith(".dist-info/METADATA")]
for meta in metas:
print("\n[METADATA:", meta, "]")
text = z.read(meta).decode("utf-8", "replace")

name_m = re.search(r"^Name:\s*(.+)$", text, re.M)
ver_m = re.search(r"^Version:\s*(.+)$", text, re.M)

if name_m:
print("Project Name:", name_m.group(1))
if ver_m:
print("Version:", ver_m.group(1))

print("\n=== SDISTS ===")
for sdist in glob.glob("dist/*.tar.gz"):
print("\n---", sdist, "---")
with tarfile.open(sdist, "r:gz") as t:
for m in t.getmembers():
print(m.name)

metas = [m for m in t.getmembers() if m.name.endswith("PKG-INFO")]
for m in metas:
print("\n[PKG-INFO:", m.name, "]")
text = t.extractfile(m).read().decode("utf-8", "replace")

name_m = re.search(r"^Name:\s*(.+)$", text, re.M)
ver_m = re.search(r"^Version:\s*(.+)$", text, re.M)

if name_m:
print("Project Name:", name_m.group(1))
if ver_m:
print("Version:", ver_m.group(1))
PY

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
Loading