diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e6a031..b49c710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,7 +83,8 @@ e il progetto aderisce al [Semantic Versioning](https://semver.org/spec/v2.0.0.h - CI/CD via GitHub Actions (mirror automatico Gitea → GitHub) - Documentazione completa (README, CONTRIBUTING, SECURITY) -[Unreleased]: https://gitea.emulab.it/Simone/nsis-plugin-ns7zip/compare/v2.2.2...HEAD +[Unreleased]: https://gitea.emulab.it/Simone/nsis-plugin-ns7zip/compare/v2.3.0...HEAD +[2.3.0]: https://gitea.emulab.it/Simone/nsis-plugin-ns7zip/compare/v2.2.2...v2.3.0 [2.2.2]: https://gitea.emulab.it/Simone/nsis-plugin-ns7zip/compare/v2.2.1...v2.2.2 [2.2.1]: https://gitea.emulab.it/Simone/nsis-plugin-ns7zip/compare/v2.2.0...v2.2.1 [2.2.0]: https://gitea.emulab.it/Simone/nsis-plugin-ns7zip/compare/v2.1.0...v2.2.0 diff --git a/tools/release-notes/v2.0.0.md b/tools/release-notes/v2.0.0.md index 5a94ec3..6d8bc76 100644 --- a/tools/release-notes/v2.0.0.md +++ b/tools/release-notes/v2.0.0.md @@ -4,5 +4,4 @@ - CI/CD via GitHub Actions (mirror automatico Gitea → GitHub) - Documentazione completa (README, CONTRIBUTING, SECURITY) ---- -_Repository primario: vedi link Gitea nel README. Il mirror GitHub è generato automaticamente._ +-- diff --git a/tools/release-notes/v2.0.1.md b/tools/release-notes/v2.0.1.md index e57c2c4..92f9ca9 100644 --- a/tools/release-notes/v2.0.1.md +++ b/tools/release-notes/v2.0.1.md @@ -4,5 +4,4 @@ - Fixed MSB8020 toolset error on GitHub Actions: `build_plugin_2600_vs2026.py` now detects the installed VS toolset dynamically (falls back to v143 on VS2022 runners) - Build script for 26.00 selects `Nsis7z_vs2026.vcxproj` (v145) or `Nsis7z.vcxproj` (v143) based on detected toolset ---- -_Repository primario: vedi link Gitea nel README. Il mirror GitHub è generato automaticamente._ +-- diff --git a/tools/release-notes/v2.1.0.md b/tools/release-notes/v2.1.0.md index c47e3c0..2ebd581 100644 --- a/tools/release-notes/v2.1.0.md +++ b/tools/release-notes/v2.1.0.md @@ -9,5 +9,4 @@ - `versions/7-zip-zstd` submodule added - `build_zstd.cmd` top-level build script for the zstd variant ---- -_Repository primario: vedi link Gitea nel README. Il mirror GitHub è generato automaticamente._ +-- diff --git a/tools/release-notes/v2.2.0.md b/tools/release-notes/v2.2.0.md index 7a62c4b..5a616aa 100644 --- a/tools/release-notes/v2.2.0.md +++ b/tools/release-notes/v2.2.0.md @@ -7,5 +7,4 @@ - `build_plugin.py` now supports both Windows (MSBuild) and Linux (MinGW-w64) targets - Windows build-script f-string fixes ---- -_Repository primario: vedi link Gitea nel README. Il mirror GitHub è generato automaticamente._ +-- diff --git a/tools/release-notes/v2.2.1.md b/tools/release-notes/v2.2.1.md index 111a763..d971428 100644 --- a/tools/release-notes/v2.2.1.md +++ b/tools/release-notes/v2.2.1.md @@ -4,5 +4,4 @@ ### Changed - GitHub Actions workflows now opt into Node 24 for JavaScript-based actions to avoid Node 20 deprecation warnings ---- -_Repository primario: vedi link Gitea nel README. Il mirror GitHub è generato automaticamente._ +-- diff --git a/tools/release-notes/v2.2.2.md b/tools/release-notes/v2.2.2.md new file mode 100644 index 0000000..d942415 --- /dev/null +++ b/tools/release-notes/v2.2.2.md @@ -0,0 +1,8 @@ +### Added +- `tools/update_gitea_releases.py`: one-shot script to backfill Gitea release bodies with CHANGELOG content via the Gitea API +- `tools/release-notes/`: per-version Markdown snippets used by the backfill script + +### Changed +- Release workflow now extracts the relevant CHANGELOG section and uses it as the GitHub Release body (`body_path`) +- Release workflow adds a step to update the corresponding Gitea release body via API (`GITEA_TOKEN` secret) +- All GitHub Actions upgraded to node24-native major versions (no more Node 20 deprecation warnings) diff --git a/tools/release-notes/v2.3.0.md b/tools/release-notes/v2.3.0.md new file mode 100644 index 0000000..16ec948 --- /dev/null +++ b/tools/release-notes/v2.3.0.md @@ -0,0 +1,14 @@ +### Added +- Auto-recreation of bundle POSIX symlinks on Linux if missing after a fresh clone (`_ensure_bundle_symlinks()` in `tools/linux/build_plugin_linux.py`) + +### Changed +- Default 7-zip version changed from `26.00` to `26.01` in `build_plugin.py` and `tools/linux/build_plugin_linux.py` +- Renamed `versions/zstd` → `versions/zstd-bundle` for naming consistency with the other bundle directories +- Auto-generated bundle symlinks are now excluded from git tracking (`.gitignore`) + +### Fixed +- Windows build error `C1083: Cannot open include file` for `Common/Common.h`, `IPassword.h`, `C/Alloc.h` and other vendor headers: added `versions/VER/CPP/7zip/UI/Common/` to `AdditionalIncludeDirectories` in all five bundle vcxproj files (25.01, 26.00, 26.01) +- f-string nested-quote syntax errors in all `tools/legacy/` build scripts (patterns `{"="*60}`, `{"-"*50}`, `{'Rebuild' if ...}`): replaced with Python 3.10/3.11-compatible equivalents + +### Removed +- One-shot `tools/fix_bundle_vcxproj_paths.py` helper (no longer needed) diff --git a/tools/update_gitea_releases.py b/tools/update_gitea_releases.py index 9ede753..e6de5e0 100644 --- a/tools/update_gitea_releases.py +++ b/tools/update_gitea_releases.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 """ -One-shot script: aggiorna il body delle release Gitea esistenti -con i file in tools/release-notes/. +Script: sincronizza le release Gitea con i file in tools/release-notes/. +- Se la release esiste → aggiorna il body +- Se la release non esiste → la crea (richiede che il tag git esista già) Uso: GITEA_TOKEN= python3 tools/update_gitea_releases.py @@ -51,28 +52,43 @@ def main() -> None: if not args.token: sys.exit("Errore: token mancante. Usa --token oppure imposta GITEA_TOKEN.") + print("Recupero lista release da Gitea...", flush=True) + try: + releases = api("GET", f"/repos/{REPO}/releases?limit=50", args.token) + except urllib.error.HTTPError: + sys.exit("Errore nel recupero delle release.") + + existing = {r["tag_name"]: r["id"] for r in releases} + note_files = sorted(NOTES_DIR.glob("v*.md")) if not note_files: sys.exit(f"Nessun file trovato in {NOTES_DIR}") for note_path in note_files: - tag = note_path.stem # es. v2.2.1 + tag = note_path.stem body = note_path.read_text(encoding="utf-8").strip() - print(f"[{tag}] recupero release...", end=" ", flush=True) - try: - release = api("GET", f"/repos/{REPO}/releases/tags/{tag}", args.token) - except urllib.error.HTTPError: - print("SALTATO (release non trovata)") - continue - - release_id = release["id"] - print(f"id={release_id}, aggiorno body...", end=" ", flush=True) - try: - api("PATCH", f"/repos/{REPO}/releases/{release_id}", args.token, {"body": body}) - print("OK") - except urllib.error.HTTPError: - print("FALLITO") + if tag in existing: + release_id = existing[tag] + print(f"[{tag}] id={release_id}, aggiorno body...", end=" ", flush=True) + try: + api("PATCH", f"/repos/{REPO}/releases/{release_id}", args.token, {"body": body}) + print("OK") + except urllib.error.HTTPError: + print("FALLITO") + else: + print(f"[{tag}] release non trovata, creo...", end=" ", flush=True) + try: + result = api("POST", f"/repos/{REPO}/releases", args.token, { + "tag_name": tag, + "name": tag, + "body": body, + "draft": False, + "prerelease": False, + }) + print(f"OK (id={result['id']})") + except urllib.error.HTTPError: + print("FALLITO (il tag git esiste su Gitea?)") if __name__ == "__main__": diff --git a/tools/update_github_releases.py b/tools/update_github_releases.py new file mode 100644 index 0000000..046fe5e --- /dev/null +++ b/tools/update_github_releases.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python3 +""" +Script: sincronizza i body delle release GitHub con i file in tools/release-notes/. +- Se la release esiste → aggiorna il body +- Se la release non esiste → la salta (le release GitHub vengono create dal workflow CI) + +Uso: + GITHUB_TOKEN= python3 tools/update_github_releases.py +oppure: + python3 tools/update_github_releases.py --token + +Richiede un PAT GitHub con permesso 'contents: write' sul repo. +""" + +import argparse +import json +import os +import sys +import urllib.request +import urllib.error +from pathlib import Path + +GITHUB_BASE = "https://api.github.com" +REPO = "systempal/nsis-plugin-ns7zip" +NOTES_DIR = Path(__file__).parent / "release-notes" + + +def api(method: str, path: str, token: str, data: dict | None = None) -> dict: + url = f"{GITHUB_BASE}{path}" + body = json.dumps(data).encode() if data else None + req = urllib.request.Request( + url, + data=body, + method=method, + headers={ + "Authorization": f"token {token}", + "Content-Type": "application/json", + "Accept": "application/vnd.github+json", + "X-GitHub-Api-Version": "2022-11-28", + "User-Agent": "update_github_releases/1.0", + }, + ) + try: + with urllib.request.urlopen(req) as resp: + return json.loads(resp.read()) + except urllib.error.HTTPError as e: + print(f" HTTP {e.code} {e.reason} — {e.read().decode()}", file=sys.stderr) + raise + + +def main() -> None: + parser = argparse.ArgumentParser(description="Update GitHub release bodies") + parser.add_argument("--token", default=os.environ.get("GITHUB_TOKEN"), help="GitHub API token") + args = parser.parse_args() + + if not args.token: + sys.exit("Errore: token mancante. Usa --token oppure imposta GITHUB_TOKEN.") + + note_files = sorted(NOTES_DIR.glob("v*.md")) + if not note_files: + sys.exit(f"Nessun file trovato in {NOTES_DIR}") + + for note_path in note_files: + tag = note_path.stem + body = note_path.read_text(encoding="utf-8").strip() + + print(f"[{tag}] recupero release...", end=" ", flush=True) + try: + release = api("GET", f"/repos/{REPO}/releases/tags/{tag}", args.token) + except urllib.error.HTTPError as e: + if e.code == 404: + print("SALTATO (release non trovata su GitHub)") + else: + print("ERRORE") + continue + + release_id = release["id"] + print(f"id={release_id}, aggiorno body...", end=" ", flush=True) + try: + api("PATCH", f"/repos/{REPO}/releases/{release_id}", args.token, {"body": body}) + print("OK") + except urllib.error.HTTPError: + print("FALLITO") + + +if __name__ == "__main__": + main()