Repository: zng-ui/zng (language: rust)

Issue:
Implement prebuilt compression
Refactor release workflow to release zipped prebuilt binaries.

Refactor `zng-view-prebuilt` to use `tar` to extract the binaries.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 5986b15a4..e3601f71e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -302,16 +302,22 @@ jobs:
       - uses: actions/download-artifact@v4
         with:
           name: prebuilt-ubuntu
-          path: prebuilt
+          path: prebuilt-ubuntu
       - uses: actions/download-artifact@v4
         with:
           name: prebuilt-windows
-          path: prebuilt
+          path: prebuilt-windows
       - uses: actions/download-artifact@v4
         with:
           name: prebuilt-macos
-          path: prebuilt
+          path: prebuilt-macos
       - run: ls --all ./prebuilt
+      - name: compress
+        run: |
+          mkdir prebuilt
+          tar -czf "/prebuilt/prebuilt-ubuntu.tar.gz" -C "prebuilt-ubuntu/" *
+          tar -czf "/prebuilt/prebuilt-windows.tar.gz" -C "prebuilt-windows/" *
+          tar -czf "/prebuilt/prebuilt-macos.tar.gz" -C "prebuilt-macos/" *
       - name: publish release
         uses: ncipollo/release-action@v1
         with:
diff --git a/README.md b/README.md
index 298f294e1..105963336 100644
--- a/README.md
+++ b/README.md
@@ -94,8 +94,8 @@ On Windows:
 On Windows 8 or older:
 
 * To build with `"view_prebuilt"`  feature:
-    - The `curl` command is required, it is available in Windows 10+, but must be 
-      [installed](https://curl.se/windows/) in older Windows and must be added to the PATH env var.
+    - The `curl` and `tar` commands are required, they are available in Windows 10+, but must be 
+      installed in older Windows and must be added to the PATH env var.
 
 on Linux:
 
diff --git a/zng-view-prebuilt/build.rs b/zng-view-prebuilt/build.rs
index 574f509c6..048d445f6 100644
--- a/zng-view-prebuilt/build.rs
+++ b/zng-view-prebuilt/build.rs
@@ -44,9 +44,19 @@ fn main() {
             .join(".zng-view-prebuilt")
             .join(format!("{file}.{version}.bin"));
         if !is_docs_rs && !lib.exists() {
-            let url = format!("https://github.com/zng-ui/zng/releases/download/v{version}/{file}");
+            #[cfg(target_os = "windows")]
+            let download_file = "prebuilt-windows.tar.gz";
 
-            let output = Path::new(&env::var("OUT_DIR").unwrap()).join(format!("v{version}.{file}"));
+            #[cfg(target_os = "linux")]
+            let download_file = "prebuilt-ubuntu.tar.gz";
+
+            #[cfg(target_os = "macos")]
+            let download_file = "prebuilt-macos.tar.gz";
+
+            let url = format!("https://github.com/zng-ui/zng/releases/download/v{version}/{download_file}");
+
+            let out_dir = env::var("OUT_DIR").unwrap();
+            let output = Path::new(&out_dir).join(download_file);
 
             let r = std::process::Command::new("curl")
                 .arg("--location")
@@ -61,7 +71,28 @@ fn main() {
             match r {
                 Ok(s) => {
                     if s.success() {
-                        lib = output;
+                        let r = std::process::Command::new("tar")
+                            .arg("-xf")
+                            .arg(output)
+                            .arg("-C")
+                            .arg(&out_dir)
+                            .status();
+
+                        match r {
+                            Ok(s) => {
+                                if s.success() {
+                                    lib = Path::new(&out_dir).join(file);
+                                } else {
+                                    println!(
+                                        "cargo:warning=view prebuilt not embedded, failed extract, tar exit code: {:?}",
+                                        s.code()
+                                    )
+                                }
+                            }
+                            Err(e) => {
+                                println!("cargo:warning=view prebuilt not embedded, failed extract, {e}");
+                            }
+                        }
                     } else {
                         println!(
                             "cargo:warning=view prebuilt not embedded, failed download, curl exit code: {:?}",


Test patch: