Add channel-aware release tooling and updater recovery
This commit is contained in:
64
scripts/build_release.py
Executable file
64
scripts/build_release.py
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Build one deterministic launcher release and its external metadata."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(PROJECT_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(PROJECT_ROOT))
|
||||
|
||||
from scripts.release_lib import ReleaseToolError, build_release # noqa: E402
|
||||
|
||||
|
||||
def build_parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("version")
|
||||
parser.add_argument("channel")
|
||||
parser.add_argument("output_directory", type=Path)
|
||||
parser.add_argument("--repository-url")
|
||||
parser.add_argument("--tag")
|
||||
parser.add_argument("--commit")
|
||||
parser.add_argument("--source-date-epoch", type=int)
|
||||
parser.add_argument("--release-notes", type=Path)
|
||||
parser.add_argument("--signing-key", type=Path)
|
||||
parser.add_argument("--require-signature", action="store_true")
|
||||
parser.add_argument("--allow-source-version-override", action="store_true")
|
||||
parser.add_argument("--archive-layout", choices=("flat", "wrapped"))
|
||||
return parser
|
||||
|
||||
|
||||
def main() -> int:
|
||||
arguments = build_parser().parse_args()
|
||||
signing_key = arguments.signing_key
|
||||
if signing_key is None and os.environ.get("PTLINUX_SIGNING_KEY"):
|
||||
signing_key = Path(os.environ["PTLINUX_SIGNING_KEY"])
|
||||
try:
|
||||
artifacts = build_release(
|
||||
arguments.version,
|
||||
arguments.channel,
|
||||
arguments.output_directory,
|
||||
repository_url=arguments.repository_url,
|
||||
tag=arguments.tag,
|
||||
commit=arguments.commit,
|
||||
source_date_epoch=arguments.source_date_epoch,
|
||||
release_notes_file=arguments.release_notes,
|
||||
signing_key=signing_key,
|
||||
require_signature=arguments.require_signature,
|
||||
allow_source_version_override=arguments.allow_source_version_override,
|
||||
archive_layout=arguments.archive_layout,
|
||||
)
|
||||
except (OSError, ValueError, ReleaseToolError) as exc:
|
||||
print(f"Release build failed: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
for artifact in artifacts:
|
||||
print(artifact)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user