From 0a6e500e369bb9abdde6a3dd52a27d358f130c8d Mon Sep 17 00:00:00 2001 From: AkiChase <1003019131@qq.com> Date: Wed, 1 May 2024 12:48:32 +0800 Subject: [PATCH] Scrcpy Mask v0.0.6 --- .github/workflows/publish.yml | 6 +++--- package.json | 5 +++-- publish.js | 36 +++++++++++++++++++++++++++++++++++ src-tauri/Cargo.toml | 2 +- 4 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 publish.js diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3beaa4f..50e4732 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,6 +5,8 @@ on: # 匹配特定标签 (refs/tags) tags: - 'v*' # 推送事件匹配 v*, 例如 v1.0,v20.15.10 等来触发工作流 + branches: + - master # This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release. @@ -60,9 +62,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. - releaseName: 'App v__VERSION__' - releaseBody: 'See the assets to download this version and install.' + releaseName: 'Scrcpy Mask ${{ github.ref_name }}' releaseDraft: true prerelease: false args: ${{ matrix.args }} diff --git a/package.json b/package.json index a75cee5..bfe3205 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,14 @@ { "name": "scrcpy-mask", "private": true, - "version": "0.0.0", + "version": "0.0.6", "type": "module", "scripts": { "dev": "vite", "build": "vue-tsc --noEmit && vite build", "preview": "vite preview", - "tauri": "tauri" + "tauri": "tauri", + "publish": "node publish.js" }, "dependencies": { "@tauri-apps/api": ">=2.0.0-beta.8", diff --git a/publish.js b/publish.js new file mode 100644 index 0000000..e0c8af7 --- /dev/null +++ b/publish.js @@ -0,0 +1,36 @@ +import { execSync } from "child_process"; +import { readFileSync, writeFileSync } from "fs"; + +// receive version arg +process.stdin.setEncoding("utf8"); +console.log("Input new version:"); +process.stdin.on("data", function (data) { + var version = data.trim(); + if (!version) { + console.log("version is required"); + console.log("Input new version:"); + return; + } + process.stdin.pause(); + console.log("publishing version: " + version); + + 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}"`; + break; + } + } + writeFileSync("./src-tauri/Cargo.toml", 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("Pleash push to github or cancel manually"); +}); diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index ead0782..45e1a1c 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scrcpy-mask" -version = "0.0.0" +version = "0.0.6" description = "A Tauri App" authors = ["AkiChase"] edition = "2021"