mirror of
https://github.com/akadeepesh/contextzip.git
synced 2026-10-20 08:36:20 +02:00
Add Python publish workflow for automated package release to PyPI
This commit is contained in:
+6
-6
@@ -27,10 +27,10 @@ jobs:
|
||||
echo "Package version : $PKG_VERSION"
|
||||
echo "Release tag : $TAG_VERSION"
|
||||
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
|
||||
echo "❌ Version mismatch — update __init__.py and pyproject.toml before releasing"
|
||||
echo "Version mismatch — update __init__.py and pyproject.toml before releasing"
|
||||
exit 1
|
||||
fi
|
||||
echo "✅ Versions match"
|
||||
echo "Versions match"
|
||||
|
||||
# ── Job 2: Build the distributions ────────────────────────────────────────
|
||||
build:
|
||||
@@ -55,12 +55,12 @@ jobs:
|
||||
import zipfile, sys, os
|
||||
wheels = [f for f in os.listdir("dist") if f.endswith(".whl")]
|
||||
if not wheels:
|
||||
print("❌ No wheel found in dist/"); sys.exit(1)
|
||||
print("No wheel found in dist/"); sys.exit(1)
|
||||
with zipfile.ZipFile(f"dist/{wheels[0]}") as z:
|
||||
names = z.namelist()
|
||||
if not any("entry_points.txt" in n for n in names):
|
||||
print("❌ entry_points.txt missing from wheel"); sys.exit(1)
|
||||
print(f"✅ Wheel OK: {wheels[0]}")
|
||||
print("entry_points.txt missing from wheel"); sys.exit(1)
|
||||
print(f"Wheel OK: {wheels[0]}")
|
||||
ep = [n for n in names if "entry_points" in n][0]
|
||||
print(z.read(ep).decode())
|
||||
EOF
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
permissions:
|
||||
id-token: write # required for trusted publishing
|
||||
id-token: write # required for trusted publishing
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/project/contextzip/${{ github.event.release.tag_name }}
|
||||
Reference in New Issue
Block a user