diff --git a/.github/RELEASE_POLICY.md b/.github/RELEASE_POLICY.md index d1ba64c..64c5a80 100644 --- a/.github/RELEASE_POLICY.md +++ b/.github/RELEASE_POLICY.md @@ -4,7 +4,7 @@ - A direct push to `main` or a PR merge into `main` is the only normal release event. PR checks, manual CI dispatch and version-tag pushes **do not** initiate publication. - Before publishing, compare the entire `github.event.before..GITHUB_SHA` range, including renamed/deleted runtime files. A release is eligible **only** if the pushed commits change a shippable add-in/runtime file, runtime resource, native component, or explicitly designated distribution input. -- The repository's `.github/release-paths.txt` is the audited allowlist; `scripts/release_changes.py` enforces it. Changes limited to README, guides, design documents, screenshots, tests, CI workflows, repository policy or GitVersion config must not publish a release. +- The repository's `.github/release-paths.txt` is the audited allowlist; the pinned shared 4FusionLab runtime-changes Action enforces it. Changes limited to README, guides, design documents, screenshots, tests, CI workflows, repository policy or GitVersion config must not publish a release. - All required existing CI checks must succeed before publishing. A failed gate means no release, no mutable tag and no replaced assets. ## Version and distribution @@ -19,3 +19,7 @@ Runtime allowlist: `filamentra/**`. Publish a versioned source ZIP plus checksum after Python tests; this is a code distribution, not yet a Fusion add-in installer. If a push changes no eligible runtime file, CI may run but the GitHub Release job is skipped, even when GitVersion computes a different candidate version. + +## Shared release actions + +Central GitVersion, runtime impact checking, notes and verified ZIP releases use `4FusionLab/.github` Actions pinned to commit `ad9d60ba4aabc494b4f2c85d6c566a50ca423751`. This repository retains its independently tested Filamentra Python source builder; the ZIP does not constitute a finished Autodesk Fusion installer. Local duplicate release helpers have been removed. diff --git a/scripts/release_changes.py b/scripts/release_changes.py deleted file mode 100644 index 69bb15a..0000000 --- a/scripts/release_changes.py +++ /dev/null @@ -1,66 +0,0 @@ -"""Decide whether a main-branch push changes shipped runtime or distribution inputs.""" -import argparse -import fnmatch -import subprocess -from pathlib import Path - - -def read_rules(path): - rules = [line.strip() for line in Path(path).read_text(encoding="utf-8").splitlines()] - return [line for line in rules if line and not line.startswith("#")] - - -def impacted(files, rules): - includes = [rule for rule in rules if not rule.startswith("!")] - excludes = [rule[1:] for rule in rules if rule.startswith("!")] - return [path for path in files if any(fnmatch.fnmatchcase(path, rule) for rule in includes) - and not any(fnmatch.fnmatchcase(path, rule) for rule in excludes)] - - -def git_paths(before, after): - if not after: - raise ValueError("The new commit SHA is required.") - if not before or before == "0" * 40: - cmd = ["git", "ls-tree", "-rz", "--name-only", after] - else: - cmd = ["git", "diff", "--name-only", "-z", "--no-renames", before, after] - output = subprocess.check_output(cmd) - return [entry.decode("utf-8", errors="surrogateescape") - for entry in output.split(b"\0") if entry] - - -def main(): - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--config", default=".github/release-paths.txt") - parser.add_argument("--before") - parser.add_argument("--after") - parser.add_argument("--changed", nargs="*") - parser.add_argument("--github-output") - parser.add_argument("--self-test", action="store_true") - args = parser.parse_args() - rules = read_rules(args.config) - if not any(not rule.startswith("!") for rule in rules): - parser.error("No runtime allowlist configured.") - if args.self_test: - excluded = ["README.md", "README.ru.md", "docs/guide.md", - ".github/workflows/ci.yml", "tests/test_example.py", - "GitVersion.yml", ".github/RELEASE_POLICY.md"] - assert not impacted(excluded, rules), "Documentation or CI would trigger a release." - first = next(rule for rule in rules if not rule.startswith("!")) - sample = first.replace("**", "example.py").replace("*", "example.py") - assert impacted([sample], rules), "The runtime allowlist must match runtime paths." - print("release path policy OK") - return - files = args.changed if args.changed is not None else git_paths(args.before, args.after) - matching = impacted(files, rules) - value = "true" if matching else "false" - print("release=" + value) - for path in matching: - print(" runtime change: " + path) - if args.github_output: - with Path(args.github_output).open("a", encoding="utf-8") as output: - output.write("release=" + value + "\n") - - -if __name__ == "__main__": - main() diff --git a/scripts/release_notes.py b/scripts/release_notes.py deleted file mode 100644 index 2beac76..0000000 --- a/scripts/release_notes.py +++ /dev/null @@ -1,39 +0,0 @@ -"""Select reviewed notes when available; otherwise generate notes from commit history.""" -import argparse -import subprocess -from pathlib import Path - - -def git(*args): - return subprocess.run(["git", *args], capture_output=True, text=True, check=False) - - -def main(): - parser = argparse.ArgumentParser(description=__doc__) - parser.add_argument("--product", required=True) - parser.add_argument("--version", required=True) - parser.add_argument("--output", required=True) - parser.add_argument("--candidate", action="append", default=[]) - args = parser.parse_args() - output = Path(args.output) - for name in args.candidate: - path = Path(name) - if path.is_file() and path.read_text(encoding="utf-8").strip(): - output.write_text(path.read_text(encoding="utf-8"), encoding="utf-8") - print("Using reviewed release notes: " + name) - return - previous = git("describe", "--tags", "--abbrev=0", "--match", "v[0-9]*", "HEAD") - base = previous.stdout.strip() if previous.returncode == 0 else None - rev = base + "..HEAD" if base else "HEAD" - command = ["git", "log", "--max-count=100", "--format=- %s (%h)", rev] - logs = subprocess.run(command, capture_output=True, text=True, check=True).stdout.strip() - if not logs: - raise SystemExit("Cannot generate release notes without changes since last tag.") - heading = f"# {args.product} v{args.version}\n\n" - context = f"Changes since {base}:\n\n" if base else "Initial release changes:\n\n" - output.write_text(heading + context + logs + "\n", encoding="utf-8") - print("Generated release notes from " + (base or "initial Git history")) - - -if __name__ == "__main__": - main()