aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/bump-tauri.ts
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2026-01-18 22:13:25 +0800
committerGitHub <noreply@github.com>2026-01-18 22:13:25 +0800
commit53d3d71b69408b5fade60fbc41cee3d8e0946cbe (patch)
treeeb54be440ee6fe7af30ea54cc2f689563dc28ef8 /scripts/bump-tauri.ts
parent30a7da9eb1734e19bdb98083bdaae757e0ce9b3a (diff)
parent09b2e0f84721587f0b0a59818ebc5720c447ebb8 (diff)
downloadDropOut-53d3d71b69408b5fade60fbc41cee3d8e0946cbe.tar.gz
DropOut-53d3d71b69408b5fade60fbc41cee3d8e0946cbe.zip
Adopt Semifold CI and prepare 0.2.0-alpha pre-release (#62)
Refer: http://semifold.noctisynth.org/ ## Summary by Sourcery Adopt Semifold-based release management and prepare the project for a 0.2.0-alpha pre-release across Rust and UI packages. New Features: - Introduce Semifold CI release workflow to orchestrate builds, publishing, and changelog management. - Add Semifold status workflow to report release status on pull requests. - Add workspace-level Node tooling and scripts to manage Tauri version bumping and project preparation. Enhancements: - Refactor GitHub Actions workflows for build, test, check, and lint to simplify pnpm usage, update action versions, and standardize artifact paths. - Move Rust profile configuration into a new Cargo workspace and add a pnpm workspace for the UI package. - Configure Semifold changelog and release metadata for Rust and Node packages, including alpha pre-release tagging. Build: - Replace the tag-triggered GitHub release workflow with a branch-based Semifold CI pipeline that builds artifacts for Linux, macOS, and Windows and uploads them for publishing. - Update CI action versions (checkout, setup-node, upload-artifact, download-artifact) and adjust Rust cache configuration and artifact locations. - Add root workspace package.json, pnpm-workspace.yaml, and pnpm overrides to centralize tooling and dependency management. CI: - Add a dedicated Semifold status GitHub Actions workflow for pull requests to main. - Update existing check, lint, test, and build workflows to align with the new workspace layout and artifact directories. Deployment: - Integrate Semifold configuration for automated publishing to crates.io and npm, including pre-checks, post-version hooks, and use of stored build artifacts in releases. Tests: - Adjust test workflow artifact paths to match the new target directory structure and workspace configuration. Chores: - Remove unused Python packaging files and old Node lockfiles that are no longer part of the build or release process.
Diffstat (limited to 'scripts/bump-tauri.ts')
-rw-r--r--scripts/bump-tauri.ts52
1 files changed, 52 insertions, 0 deletions
diff --git a/scripts/bump-tauri.ts b/scripts/bump-tauri.ts
new file mode 100644
index 0000000..0cf6aea
--- /dev/null
+++ b/scripts/bump-tauri.ts
@@ -0,0 +1,52 @@
+import fs from "node:fs";
+import path from "node:path";
+import consola from "consola";
+import toml from "toml";
+
+const tauriJsonPath = path.join(
+ __dirname,
+ "..",
+ "src-tauri",
+ "tauri.conf.json",
+);
+consola.debug("tauriJsonPath:", tauriJsonPath);
+const tauriTomlPath = path.join(__dirname, "..", "src-tauri", "Cargo.toml");
+consola.debug("tauriTomlPath:", tauriTomlPath);
+
+const getCurrentVersion = () => {
+ const tauriJsonData = fs.readFileSync(tauriJsonPath, "utf8");
+ const tauriJson = JSON.parse(tauriJsonData);
+ const version = tauriJson.version;
+ if (!version) throw new Error("Version field not found in tauri.conf.json");
+ return version;
+};
+
+const getBumpVersion = () => {
+ const tauriTomlData = fs.readFileSync(tauriTomlPath, "utf8");
+ const tauriToml = toml.parse(tauriTomlData);
+ const version = tauriToml.package.version;
+ if (!version) throw new Error("Version field not found in Cargo.toml");
+ return version;
+};
+
+const replaceVersion = (content: string, version: string) => {
+ const newJson = content.replace(
+ /"version": "[^"]+"/,
+ `"version": "${version}"`,
+ );
+ return newJson;
+};
+
+const tauriJsonData = fs.readFileSync(tauriJsonPath, "utf8");
+const currentVersion = getCurrentVersion();
+const bumpVersion = getBumpVersion();
+consola.debug("currentVersion:", currentVersion);
+consola.debug("bumpVersion:", bumpVersion);
+
+if (currentVersion !== bumpVersion) {
+ const replacedData = replaceVersion(tauriJsonData, bumpVersion);
+ consola.info(`Bumped version from ${currentVersion} to ${bumpVersion}`);
+ fs.writeFileSync(tauriJsonPath, replacedData);
+} else {
+ consola.info(`Version ${currentVersion} is already up-to-date`);
+}