Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.
Rust chatgptclaudeclidesktopdesktop-appelectron-alternativegeminilinuxmacosnativefierno-electronrusttauriweb-to-desktopwebsite-to-appwebviewwindowsyoutube
fix: harden zst and release packaging
Tw93ca2accfdfcd8
diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.ymlindex e8dd06bf..9661b4fc 100644--- a/.github/workflows/npm-publish.yml+++ b/.github/workflows/npm-publish.yml@@ -25,6 +25,14 @@ jobs:- name: Checkout repositoryuses: actions/checkout@v6+ - name: Check manual publish branch+ if: github.event_name == 'workflow_dispatch'+ run: |+ if [ "$GITHUB_REF" != "refs/heads/main" ]; then+ echo "Manual npm publish must run from main, got ${GITHUB_REF}."+ exit 1+ fi+- name: Install pnpmuses: pnpm/action-setup@v4with:diff --git a/.github/workflows/pake-cli.yaml b/.github/workflows/pake-cli.yamlindex 80dc92a1..41bd9981 100644--- a/.github/workflows/pake-cli.yaml+++ b/.github/workflows/pake-cli.yaml@@ -59,7 +59,7 @@ on:type: booleandefault: falsetargets:- description: "Package formats (comma-separated: deb,appimage,rpm)"+ description: "Package formats (comma-separated: deb,appimage,rpm,zst)"required: falsedefault: "deb"@@ -223,6 +223,24 @@ jobs:retention-days: 3if-no-files-found: ignore+ - name: Upload RPM (Linux)+ if: runner.os == 'Linux'+ uses: actions/upload-artifact@v6+ with:+ name: ${{ inputs.name }}-Linux-rpm+ path: ${{ inputs.name }}.rpm+ retention-days: 3+ if-no-files-found: ignore++ - name: Upload ZST (Linux)+ if: runner.os == 'Linux'+ uses: actions/upload-artifact@v6+ with:+ name: ${{ inputs.name }}-Linux-zst+ path: ${{ inputs.name }}-*.pkg.tar.zst+ retention-days: 3+ if-no-files-found: ignore+- name: Upload MSI (Windows)if: runner.os == 'Windows'uses: actions/upload-artifact@v6diff --git a/README.md b/README.mdindex 11027c21..26b5526f 100644--- a/README.md+++ b/README.md@@ -215,4 +215,4 @@ Pake's development can not be without these Hackers. They contributed a lot of c## License-Pake is open source under GPL-3.0, see [LICENSE](./LICENSE); apps you build with Pake are entirely yours to use and distribute. If you fork Pake into your own product, to avoid confusion please give it a different name and credit Pake as the source.+Pake is open source under GPL-3.0, see [LICENSE](./LICENSE) and [Pake Output Exception](./LICENSE-EXCEPTION); apps you build with Pake are entirely yours to use and distribute. If you fork Pake into your own product, to avoid confusion please give it a different name and credit Pake as the source.diff --git a/README_CN.md b/README_CN.mdindex 91464ca2..f5708e3b 100644--- a/README_CN.md+++ b/README_CN.md@@ -217,4 +217,4 @@ Pake 的发展离不开这些优秀的贡献者 ❤️## 开源协议-Pake 使用 GPL-3.0 协议开源,详见 [LICENSE](./LICENSE),用 Pake 打包生成的应用所有权完全归你,可以自由使用和分发;假如你想基于 fork 重新做一个 Pake 产品,为了避免误解,辛苦换一个名字,并注明来源。+Pake 使用 GPL-3.0 协议开源,详见 [LICENSE](./LICENSE) 和 [Pake Output Exception](./LICENSE-EXCEPTION),用 Pake 打包生成的应用所有权完全归你,可以自由使用和分发;假如你想基于 fork 重新做一个 Pake 产品,为了避免误解,辛苦换一个名字,并注明来源。diff --git a/bin/builders/LinuxBuilder.ts b/bin/builders/LinuxBuilder.tsindex 09532150..3af51e2f 100644--- a/bin/builders/LinuxBuilder.ts+++ b/bin/builders/LinuxBuilder.ts@@ -5,7 +5,11 @@ import { PakeAppOptions } from '@/types';import tauriConfig from '@/helpers/tauriConfig';import { shellExec } from '@/utils/shell';import { generateLinuxPackageName } from '@/utils/name';-import { LINUX_TARGET_TYPES, filterLinuxTargets } from '@/utils/targets';+import {+ LINUX_TARGET_TYPES,+ filterLinuxTargets,+ needsTemporaryDebForZst,+} from '@/utils/targets';import logger from '@/options/logger';export default class LinuxBuilder extends BaseBuilder {@@ -66,12 +70,17 @@ export default class LinuxBuilder extends BaseBuilder {`No valid Linux target in "${this.options.targets}". Valid targets: ${LINUX_TARGET_TYPES.join(', ')}.`,);}+ const useTemporaryDebForZst = needsTemporaryDebForZst(targets);for (const target of targets) {this.currentBuildType = target;if (target === 'zst') {- await this.buildAndCopy(url, 'deb', false);- await this.createArchPackageFromDeb();+ if (useTemporaryDebForZst) {+ await this.buildAndCopy(url, 'deb', false);+ }+ await this.createArchPackageFromDeb({+ removeSourceDeb: useTemporaryDebForZst,+ });} else {await this.buildAndCopy(url, target);}@@ -94,7 +103,11 @@ export default class LinuxBuilder extends BaseBuilder {}}- private async createArchPackageFromDeb() {+ private async createArchPackageFromDeb({+ removeSourceDeb,+ }: {+ removeSourceDeb: boolean;+ }) {const { name = 'pake-app' } = this.options;const packageName = generateLinuxPackageName(name);const version = tauriConfig.version;@@ -178,10 +191,12 @@ post_remove() {await shellExec(`bsdtar --zstd -cf "${packagePath}" -C "${dataDir}" .PKGINFO .INSTALL usr`,);- await fsExtra.remove(debPath);logger.success('✔ Build success!');logger.success('✔ App installer located in', packagePath);} finally {+ if (removeSourceDeb) {+ await fsExtra.remove(debPath);+ }await fsExtra.remove(workDir);}}diff --git a/bin/utils/targets.ts b/bin/utils/targets.tsindex b3a9b61a..99599d0e 100644--- a/bin/utils/targets.ts+++ b/bin/utils/targets.ts@@ -6,3 +6,7 @@ export function filterLinuxTargets(targets: string): string[] {const requested = targets.split(',').map((target) => target.trim());return LINUX_TARGET_TYPES.filter((target) => requested.includes(target));}++export function needsTemporaryDebForZst(targets: string[]): boolean {+ return targets.includes('zst') && !targets.includes('deb');+}diff --git a/dist/cli.js b/dist/cli.jsindex 9337e411..a909f417 100644--- a/dist/cli.js+++ b/dist/cli.js@@ -46,6 +46,7 @@ var keywords = ["productivity"];var files = [+ "LICENSE-EXCEPTION","dist","src-tauri"];@@ -417,6 +418,9 @@ function filterLinuxTargets(targets) {const requested = targets.split(',').map((target) => target.trim());return LINUX_TARGET_TYPES.filter((target) => requested.includes(target));}+function needsTemporaryDebForZst(targets) {+ return targets.includes('zst') && !targets.includes('deb');+}/*** Pure transform from CLI options to the window-config slice that gets@@ -1407,11 +1411,16 @@ class LinuxBuilder extends BaseBuilder {if (targets.length === 0) {throw new Error(`No valid Linux target in "${this.options.targets}". Valid targets: ${LINUX_TARGET_TYPES.join(', ')}.`);}+ const useTemporaryDebForZst = needsTemporaryDebForZst(targets);for (const target of targets) {this.currentBuildType = target;if (target === 'zst') {- await this.buildAndCopy(url, 'deb', false);- await this.createArchPackageFromDeb();+ if (useTemporaryDebForZst) {+ await this.buildAndCopy(url, 'deb', false);+ }+ await this.createArchPackageFromDeb({+ removeSourceDeb: useTemporaryDebForZst,+ });}else {await this.buildAndCopy(url, target);@@ -1432,7 +1441,7 @@ class LinuxBuilder extends BaseBuilder {}}}- async createArchPackageFromDeb() {+ async createArchPackageFromDeb({ removeSourceDeb, }) {const { name = 'pake-app' } = this.options;const packageName = generateLinuxPackageName(name);const version = tauriConfig.version;@@ -1493,11 +1502,13 @@ post_remove() {}`);await shellExec(`bsdtar --zstd -cf "${packagePath}" -C "${dataDir}" .PKGINFO .INSTALL usr`);- await fsExtra.remove(debPath);logger.success('✔ Build success!');logger.success('✔ App installer located in', packagePath);}finally {+ if (removeSourceDeb) {+ await fsExtra.remove(debPath);+ }await fsExtra.remove(workDir);}}diff --git a/package.json b/package.jsonindex 69e1c1c0..84b483c7 100644--- a/package.json+++ b/package.json@@ -26,6 +26,7 @@"productivity"],"files": [+ "LICENSE-EXCEPTION","dist","src-tauri"],diff --git a/scripts/check-release-version.mjs b/scripts/check-release-version.mjsindex 1bf87b79..5dcda6e0 100644--- a/scripts/check-release-version.mjs+++ b/scripts/check-release-version.mjs@@ -85,6 +85,12 @@ expectEqual("git+https://github.com/tw93/Pake.git",);+if (!packageJson.files?.includes("LICENSE-EXCEPTION")) {+ errors.push(+ "package.json files: LICENSE-EXCEPTION must be included in the npm package",+ );+}+if (errors.length > 0) {console.error("Release version check failed:");for (const error of errors) {diff --git a/tests/integration/workflow-paths.test.js b/tests/integration/workflow-paths.test.jsindex 4d6603e6..cc209dfb 100644--- a/tests/integration/workflow-paths.test.js+++ b/tests/integration/workflow-paths.test.js@@ -6,6 +6,7 @@*/import { describe, it, expect } from "vitest";+import fs from "fs";import path from "path";describe("Workflow path integration", () => {@@ -27,6 +28,9 @@ describe("Workflow path integration", () => {primary: "appname.rpm",fallback: "src-tauri/target/release/bundle/rpm",},+ zst: {+ primary: "appname-1.0.0-1-x86_64.pkg.tar.zst",+ },};// Verify paths are defined@@ -34,6 +38,8 @@ describe("Workflow path integration", () => {expect(linuxPaths.deb.fallback).toBeTruthy();expect(linuxPaths.appimage.primary).toBeTruthy();expect(linuxPaths.appimage.fallback).toBeTruthy();+ expect(linuxPaths.rpm.primary).toBeTruthy();+ expect(linuxPaths.zst.primary).toBeTruthy();});it("should match Windows output paths", () => {@@ -99,12 +105,36 @@ describe("Workflow path integration", () => {it("should filter valid targets", () => {const targets = "deb,invalid,appimage";const parsedTargets = targets.split(",").map((t) => t.trim());- const validTargets = ["deb", "appimage", "rpm"];+ const validTargets = ["deb", "appimage", "rpm", "zst"];const filtered = parsedTargets.filter((t) => validTargets.includes(t));expect(filtered).toEqual(["deb", "appimage"]);expect(filtered).not.toContain("invalid");});++ it("should keep zst in valid Linux targets", () => {+ const targets = "deb,zst";+ const parsedTargets = targets.split(",").map((t) => t.trim());+ const validTargets = ["deb", "appimage", "rpm", "zst"];+ const filtered = parsedTargets.filter((t) => validTargets.includes(t));++ expect(filtered).toEqual(["deb", "zst"]);+ });+ });++ describe("Workflow artifact uploads", () => {+ it("should upload every Linux workflow package format", () => {+ const workflow = fs.readFileSync(+ ".github/workflows/pake-cli.yaml",+ "utf8",+ );++ expect(workflow).toContain("Upload DEB (Linux)");+ expect(workflow).toContain("Upload AppImage (Linux)");+ expect(workflow).toContain("Upload RPM (Linux)");+ expect(workflow).toContain("Upload ZST (Linux)");+ expect(workflow).toContain("path: ${{ inputs.name }}-*.pkg.tar.zst");+ });});describe("Architecture-specific paths", () => {diff --git a/tests/unit/builders.test.ts b/tests/unit/builders.test.tsindex 7747f8a6..cafe1e05 100644--- a/tests/unit/builders.test.ts+++ b/tests/unit/builders.test.ts@@ -2,6 +2,7 @@ import { describe, it, expect } from 'vitest';import {LINUX_TARGET_TYPES,filterLinuxTargets,+ needsTemporaryDebForZst,} from '../../bin/utils/targets.js';describe('Linux target filtering', () => {@@ -57,4 +58,11 @@ describe('Linux target filtering', () => {it('covers exactly the supported Linux formats', () => {expect(LINUX_TARGET_TYPES).toEqual(['deb', 'appimage', 'rpm', 'zst']);});++ it('uses a temporary deb only when zst is requested without deb', () => {+ expect(needsTemporaryDebForZst(['zst'])).toBe(true);+ expect(needsTemporaryDebForZst(['appimage', 'zst'])).toBe(true);+ expect(needsTemporaryDebForZst(['deb', 'zst'])).toBe(false);+ expect(needsTemporaryDebForZst(['deb', 'appimage'])).toBe(false);+ });});