Files
RawMark/scripts/package-release.py
T
root 469af15045
GitHub Git mirror / mirror (push) Skipped
Development CI / check-and-package (push) Successful in 4m3s
Development CI / image (push) Successful in 28s
Development CI / deploy-development (push) Successful in 11s
ci: separate dev deployment, main checks and GitHub mirroring
2026-10-29 21:03:01 +08:00

26 lines
876 B
Python

#!/usr/bin/env python3
"""Package the already-tested native executable and licenses for a release."""
from pathlib import Path
import sys
import tarfile
import zipfile
system, arch = sys.argv[1:]
from release import build_version
version = build_version()
from release import archive_name
name = archive_name(version, system + '/' + arch).removesuffix('.zip').removesuffix('.tar.gz')
package = Path('package')
files = sorted(p for p in package.rglob('*') if p.is_file())
if system == 'windows':
with zipfile.ZipFile(f'downloads/{name}.zip', 'w', compression=zipfile.ZIP_DEFLATED) as archive:
for file in files:
archive.write(file, file.relative_to(package).as_posix())
else:
with tarfile.open(f'downloads/{name}.tar.gz', 'w:gz') as archive:
for file in files:
archive.add(file, arcname=file.relative_to(package).as_posix())