2026-11-18 01:22:00 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
"""Build the WordPress ZIP from explicitly listed release files."""
|
|
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
import re
|
|
|
|
|
import sys
|
|
|
|
|
from zipfile import ZIP_DEFLATED, ZipFile
|
|
|
|
|
|
|
|
|
|
|
2026-11-18 15:21:05 +01:00
|
|
|
from sync_shared import verify_shared
|
|
|
|
|
|
2026-11-18 01:22:00 +01:00
|
|
|
root = Path(__file__).resolve().parents[1]
|
2026-11-18 15:21:05 +01:00
|
|
|
verify_shared(root)
|
2026-11-18 01:22:00 +01:00
|
|
|
destination = Path(sys.argv[1]) if len(sys.argv) > 1 else root / "dist"
|
|
|
|
|
version = re.search(r"^ \* Version: (\S+)$", (root / "hg-socialfeed.php").read_text(), re.MULTILINE)
|
|
|
|
|
if not version:
|
|
|
|
|
raise SystemExit("Missing plugin version")
|
|
|
|
|
|
|
|
|
|
files = (
|
|
|
|
|
"hg-socialfeed.php",
|
|
|
|
|
"README.md",
|
|
|
|
|
"readme.txt",
|
|
|
|
|
"LICENSE",
|
|
|
|
|
"includes/hg-admin-menu.php",
|
2026-11-18 01:46:55 +01:00
|
|
|
"includes/hg-plugin-updates.php",
|
2026-11-18 01:22:00 +01:00
|
|
|
"includes/admin.php",
|
|
|
|
|
"includes/sources.php",
|
|
|
|
|
"includes/instagram.php",
|
|
|
|
|
"includes/facebook.php",
|
|
|
|
|
"includes/x.php",
|
|
|
|
|
"includes/shortcode.php",
|
|
|
|
|
"assets/hg-admin-menu.css",
|
2026-11-18 01:46:55 +01:00
|
|
|
"assets/admin.css",
|
2026-11-18 01:22:00 +01:00
|
|
|
"assets/feed.css",
|
|
|
|
|
"assets/feed.js",
|
|
|
|
|
)
|
|
|
|
|
destination.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
release = destination / f"hg-socialfeed-{version[1]}.zip"
|
|
|
|
|
with ZipFile(release, "w", ZIP_DEFLATED) as archive:
|
|
|
|
|
for file in files:
|
|
|
|
|
archive.write(root / file, Path("hg_socialfeed") / file)
|
|
|
|
|
print(release.resolve())
|