Skip to content

Commit 09bdd68

Browse files
committed
ci: Add GitHub Actions workflow for build and release
1 parent 043a331 commit 09bdd68

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- os: ubuntu-latest
2424
platform_tag: linux-x64
2525
provider: cpu
26-
archive_ext: tar.gz
26+
archive_ext: tar.xz
2727
steps:
2828
- name: Checkout repository
2929
uses: actions/checkout@v4

modules/license-plate/runtime-manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ async function extractArchive(archivePath, targetDir, type) {
160160
await extractZip(archivePath, { dir: targetDir });
161161
return;
162162
}
163-
if (type === 'tar.gz' || type === 'tgz') {
163+
if (type === 'tar.gz' || type === 'tgz' || type === 'tar.xz' || type === 'txz') {
164164
await tar.x({ file: archivePath, cwd: targetDir });
165165
return;
166166
}

python_src/build_license_plate_runtime.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ def detect_platform_tag() -> str:
6060

6161

6262
def get_default_archive_ext(platform_tag: str) -> str:
63-
return "zip" if platform_tag.startswith("win32") else "tar.gz"
63+
if platform_tag.startswith("win32"):
64+
return "zip"
65+
return "tar.xz"
6466

6567

6668
def run(cmd: list[str], cwd: Path | None = None, env: dict[str, str] | None = None) -> None:
@@ -154,8 +156,14 @@ def make_archive(staging_dir: Path, archive_dir: Path, archive_name: str, fmt: s
154156

155157
if fmt in {"tar.gz", "tgz"}:
156158
archive_path = archive_dir / f"{archive_name}.tar.gz"
157-
with tarfile.open(archive_path, "w:gz") as tar:
158-
tar.add(staging_dir, arcname=".")
159+
with tarfile.open(archive_path, "w:gz") as tar_obj:
160+
tar_obj.add(staging_dir, arcname=".")
161+
return archive_path
162+
163+
if fmt in {"tar.xz", "txz"}:
164+
archive_path = archive_dir / f"{archive_name}.tar.xz"
165+
with tarfile.open(archive_path, "w:xz") as tar_obj:
166+
tar_obj.add(staging_dir, arcname=".")
159167
return archive_path
160168

161169
raise ValueError(f"Unsupported archive format: {fmt}")

0 commit comments

Comments
 (0)