Files
coco-app/scripts/release.ts
ayangweb ca9adb515b chore: support for github action releases (#169)
* chore: support for github action releases (#165)

* chore: support for generating update files (#168)

* chore: support for github action releases

* chore: support for generating update files

* chore: include TAURI_SIGNING_PRIVATE_KEY_PASSWORD variable in the release

* chore: replacing the pubkey when updating
2025-02-21 16:52:52 +08:00

24 lines
731 B
TypeScript

import { readFileSync, writeFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { name, version } from "../package.json";
const __dirname = dirname(fileURLToPath(import.meta.url));
(() => {
const tomlPath = resolve(__dirname, "..", "src-tauri", "Cargo.toml");
const lockPath = resolve(__dirname, "..", "src-tauri", "Cargo.lock");
for (const path of [tomlPath, lockPath]) {
let content = readFileSync(path, "utf-8");
const regexp = new RegExp(
`(name\\s*=\\s*"${name}"\\s*version\\s*=\\s*)"(\\d+\\.\\d+\\.\\d+(-\\w+\\.\\d+)?)"`
);
content = content.replace(regexp, `$1"${version}"`);
writeFileSync(path, content);
}
})();