From 991b02bc5789413c1f8a53b2310b4c2348ae549e Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Thu, 2 May 2024 08:44:01 +0800 Subject: [PATCH] Scrcpy Mask v0.1.1 --- .github/workflows/publish.yml | 3 +-- package.json | 2 +- publish.js | 36 ++++++++++++++++++++++++++++------- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4498249..df56e52 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,8 +60,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tagName: "app-${{ github.ref_name }}" - releaseName: "Scrcpy Mask ${{ github.ref_name }}" + releaseName: "Scrcpy Mask v__VERSION__" releaseBody: "Add release notes here." releaseDraft: true prerelease: false diff --git a/package.json b/package.json index 821270e..aa78a4c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "scrcpy-mask", "private": true, - "version": "0.1.0", + "version": "0.1.1", "type": "module", "scripts": { "dev": "vite", diff --git a/publish.js b/publish.js index f4268b9..9047eb4 100644 --- a/publish.js +++ b/publish.js @@ -14,23 +14,45 @@ process.stdin.on("data", function (data) { process.stdin.pause(); console.log("publishing version: " + version); + console.log("update tauri.conf.json version"); + const tauri_path = "./src-tauri/tauri.conf.json"; + const tauri_lines = readFileSync(tauri_path, "utf8").split( + "\n" + ); + for (let i = 0; i < tauri_lines.length; i++) { + if (tauri_lines[i].includes("version")) { + tauri_lines[i] = ` "version": "${version}",`; + break; + } + } + writeFileSync(tauri_path, tauri_lines.join("\n")); + console.log("update package.json version"); console.log( execSync("pnpm version --no-git-tag-version " + version).toString() ); console.log("update cargo.toml version\n"); - const lines = readFileSync("./src-tauri/Cargo.toml", "utf8").split("\n"); - for (let i = 0; i < lines.length; i++) { - if (lines[i].startsWith("version")) { - lines[i] = `version = "${version}"`; + const cargo_path = "./src-tauri/Cargo.toml"; + const cargo_lines = readFileSync(cargo_path, "utf8").split( + "\n" + ); + for (let i = 0; i < cargo_lines.length; i++) { + if (cargo_lines[i].startsWith("version")) { + cargo_lines[i] = `version = "${version}"`; break; } } - writeFileSync("./src-tauri/Cargo.toml", lines.join("\n")); + writeFileSync(cargo_path, cargo_lines.join("\n")); console.log("git commit and tag"); - console.log(execSync(`git add . && git commit -m "Scrcpy Mask v${version}" && git tag v${version}`).toString()); + console.log( + execSync( + `git add . && git commit -m "Scrcpy Mask v${version}" && git tag v${version}` + ).toString() + ); - console.log("Pleash push commit and tag to github manually:\ngit push && git push --tags"); + console.log( + "Pleash push commit and tag to github manually:\ngit push && git push --tags" + ); }); diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 91057de..4a66174 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scrcpy-mask" -version = "0.1.0" +version = "0.1.1" description = "A Tauri App" authors = ["AkiChase"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index ede5a75..79bd1f3 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,6 +1,6 @@ { "productName": "scrcpy-mask", - "version": "0.0.0", + "version": "0.1.1", "identifier": "com.akichase.mask", "build": { "beforeDevCommand": "pnpm dev",