Files
yaak-mountain-loop/.github/scripts/preserve-release-artifacts.mjs
T
Gregory SchierandClaude Opus 5.5 1e8ecfd1a2 Remove the CEF build and upgrade Tauri
The experimental Linux CEF build is gone: its release jobs, tarball step,
cache and artifact pattern, the `cef` feature and its cfg branches. With it
goes the patch pinning tauri and tauri-build to Tauri's feat/cef branch, and
the 3.0 alpha cef CLI that every platform's release was bundled by.

Tauri moves to 2.12.7 (tauri-build 2.7.6, tauri-plugin 2.7.4), the updater
to 2.14.1 and every other plugin to its current 2.x release; the JS API to
2.12.5 and the CLI to 2.12.6. The old updater's zip 4.6.1 leaves the lockfile.

Two behavior changes in the new versions are handled. Tauri now drops a
window's listeners as it closes, so the update prompt's reply listener moves
to the app, keeping a closed window from turning a pending prompt into the
native dialog. Single-instance now releases its lock after the exit handler,
so the client releases it before relaunching after an update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 09:10:28 -07:00

76 lines
2.7 KiB
JavaScript

// Retain only distributable bundle files, never the target tree or signing material.
import { createHash } from "node:crypto";
import {
copyFileSync,
createReadStream,
existsSync,
mkdirSync,
readdirSync,
writeFileSync,
} from "node:fs";
import { join, relative } from "node:path";
const env = process.env;
const bundle = join("target", env.RELEASE_TARGET || "", "release", "bundle");
const destination = join(env.RUNNER_TEMP, "yaak-release-artifacts");
const extensions =
/\.(dmg|deb|rpm|AppImage|exe|msi|app\.tar\.gz|AppImage\.tar\.gz|nsis\.zip|msi\.zip)(\.sig)?$/;
const files = [];
function snapshot(directory) {
if (!existsSync(directory)) return;
for (const entry of readdirSync(directory, { withFileTypes: true })) {
const source = join(directory, entry.name);
// Only descend through the bundler's immediate output folders. This excludes
// .app trees (which contain executables).
if (entry.isDirectory() && directory === bundle) {
snapshot(source);
} else if (entry.isFile() && extensions.test(entry.name)) {
// Match tauri-action's default macOS updater asset naming exactly.
const arch = env.RELEASE_ARCH === "arm64" ? "aarch64" : "x64";
const assetName = entry.name.replace(/\.app\.tar\.gz(\.sig)?$/, `_${arch}.app.tar.gz$1`);
mkdirSync(destination, { recursive: true });
const retained = join(destination, assetName);
// The second snapshot must not overwrite the original user installer/signature.
if (!existsSync(retained)) copyFileSync(source, retained);
files.push({ source: relative(".", source), assetName });
}
}
}
snapshot(bundle);
if (existsSync(destination)) {
const assets = readdirSync(destination)
.filter((name) => name !== "provenance.json")
.sort();
const checksums = [];
for (const assetName of assets) {
const hash = createHash("sha256");
for await (const chunk of createReadStream(join(destination, assetName))) hash.update(chunk);
checksums.push({ assetName, sha256: hash.digest("hex") });
}
writeFileSync(
join(destination, "provenance.json"),
JSON.stringify(
{
repository: env.GITHUB_REPOSITORY,
tag: env.GITHUB_REF_NAME,
sha: env.GITHUB_SHA,
runId: env.GITHUB_RUN_ID,
runAttempt: env.GITHUB_RUN_ATTEMPT,
workflowRef: env.GITHUB_WORKFLOW_REF,
workflowSha: env.GITHUB_WORKFLOW_SHA,
tauriAction: "tauri-apps/tauri-action@v0",
platform: env.RELEASE_PLATFORM,
arch: env.RELEASE_ARCH,
target: env.RELEASE_TARGET,
args: env.RELEASE_ARGS,
assets: checksums,
},
null,
2,
) + "\n",
);
}
console.log(`Found ${files.length} distributable bundle files in ${bundle}`);