mirror of
https://github.com/katanemo/plano.git
synced 2026-06-17 15:25:17 +02:00
gzip build artifacts before uploading to github releases
This commit is contained in:
parent
9e9de86961
commit
ec856b96f8
2 changed files with 32 additions and 16 deletions
23
.github/workflows/publish-binaries.yml
vendored
23
.github/workflows/publish-binaries.yml
vendored
|
|
@ -28,13 +28,15 @@ jobs:
|
|||
working-directory: crates
|
||||
run: cargo build --release --target wasm32-wasip1 -p llm_gateway -p prompt_gateway
|
||||
|
||||
- name: Upload WASM plugins to release
|
||||
- name: Compress and upload WASM plugins to release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
gzip -k crates/target/wasm32-wasip1/release/prompt_gateway.wasm
|
||||
gzip -k crates/target/wasm32-wasip1/release/llm_gateway.wasm
|
||||
gh release upload "${{ github.event.release.tag_name || inputs.tag }}" \
|
||||
crates/target/wasm32-wasip1/release/prompt_gateway.wasm \
|
||||
crates/target/wasm32-wasip1/release/llm_gateway.wasm \
|
||||
crates/target/wasm32-wasip1/release/prompt_gateway.wasm.gz \
|
||||
crates/target/wasm32-wasip1/release/llm_gateway.wasm.gz \
|
||||
--clobber
|
||||
|
||||
build-brightstaff-linux-amd64:
|
||||
|
|
@ -50,13 +52,14 @@ jobs:
|
|||
working-directory: crates
|
||||
run: cargo build --release -p brightstaff
|
||||
|
||||
- name: Upload brightstaff to release
|
||||
- name: Compress and upload brightstaff to release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
cp crates/target/release/brightstaff brightstaff-linux-amd64
|
||||
gzip brightstaff-linux-amd64
|
||||
gh release upload "${{ github.event.release.tag_name || inputs.tag }}" \
|
||||
brightstaff-linux-amd64 \
|
||||
brightstaff-linux-amd64.gz \
|
||||
--clobber
|
||||
|
||||
build-brightstaff-linux-arm64:
|
||||
|
|
@ -72,13 +75,14 @@ jobs:
|
|||
working-directory: crates
|
||||
run: cargo build --release -p brightstaff
|
||||
|
||||
- name: Upload brightstaff to release
|
||||
- name: Compress and upload brightstaff to release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
cp crates/target/release/brightstaff brightstaff-linux-arm64
|
||||
gzip brightstaff-linux-arm64
|
||||
gh release upload "${{ github.event.release.tag_name || inputs.tag }}" \
|
||||
brightstaff-linux-arm64 \
|
||||
brightstaff-linux-arm64.gz \
|
||||
--clobber
|
||||
|
||||
build-brightstaff-darwin-arm64:
|
||||
|
|
@ -94,11 +98,12 @@ jobs:
|
|||
working-directory: crates
|
||||
run: cargo build --release -p brightstaff
|
||||
|
||||
- name: Upload brightstaff to release
|
||||
- name: Compress and upload brightstaff to release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
cp crates/target/release/brightstaff brightstaff-darwin-arm64
|
||||
gzip brightstaff-darwin-arm64
|
||||
gh release upload "${{ github.event.release.tag_name || inputs.tag }}" \
|
||||
brightstaff-darwin-arm64 \
|
||||
brightstaff-darwin-arm64.gz \
|
||||
--clobber
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
import gzip
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tarfile
|
||||
|
|
@ -184,17 +186,22 @@ def ensure_wasm_plugins():
|
|||
else:
|
||||
log.info("WASM plugins found (unknown version, re-downloading...)")
|
||||
|
||||
# 3. Download from GitHub releases
|
||||
# 3. Download from GitHub releases (gzipped)
|
||||
os.makedirs(PLANO_PLUGINS_DIR, exist_ok=True)
|
||||
|
||||
for name, dest in [
|
||||
("prompt_gateway.wasm", prompt_gw_path),
|
||||
("llm_gateway.wasm", llm_gw_path),
|
||||
]:
|
||||
url = f"{PLANO_RELEASE_BASE_URL}/{version}/{name}"
|
||||
print(f"Downloading {name} ({version})...")
|
||||
gz_name = f"{name}.gz"
|
||||
url = f"{PLANO_RELEASE_BASE_URL}/{version}/{gz_name}"
|
||||
print(f"Downloading {gz_name} ({version})...")
|
||||
print(f" URL: {url}")
|
||||
_download_file(url, dest)
|
||||
gz_dest = dest + ".gz"
|
||||
_download_file(url, gz_dest)
|
||||
with gzip.open(gz_dest, "rb") as f_in, open(dest, "wb") as f_out:
|
||||
shutil.copyfileobj(f_in, f_out)
|
||||
os.unlink(gz_dest)
|
||||
print(f" Saved to {dest}")
|
||||
|
||||
with open(version_path, "w") as f:
|
||||
|
|
@ -229,16 +236,20 @@ def ensure_brightstaff_binary():
|
|||
else:
|
||||
log.info("brightstaff found (unknown version, re-downloading...)")
|
||||
|
||||
# 3. Download from GitHub releases
|
||||
# 3. Download from GitHub releases (gzipped)
|
||||
slug = _get_platform_slug()
|
||||
filename = f"brightstaff-{slug}"
|
||||
filename = f"brightstaff-{slug}.gz"
|
||||
url = f"{PLANO_RELEASE_BASE_URL}/{version}/{filename}"
|
||||
|
||||
os.makedirs(PLANO_BIN_DIR, exist_ok=True)
|
||||
|
||||
print(f"Downloading brightstaff ({version}) for {slug}...")
|
||||
print(f" URL: {url}")
|
||||
_download_file(url, brightstaff_path)
|
||||
gz_path = brightstaff_path + ".gz"
|
||||
_download_file(url, gz_path)
|
||||
with gzip.open(gz_path, "rb") as f_in, open(brightstaff_path, "wb") as f_out:
|
||||
shutil.copyfileobj(f_in, f_out)
|
||||
os.unlink(gz_path)
|
||||
|
||||
os.chmod(brightstaff_path, 0o755)
|
||||
with open(version_path, "w") as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue