mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 00:53:45 +08:00
feat: add scripts for managing alpha versioning and update workflow
This commit is contained in:
parent
ec30b888d1
commit
55dc416109
9
.github/workflows/alpha.yml
vendored
9
.github/workflows/alpha.yml
vendored
@ -246,6 +246,9 @@ jobs:
|
|||||||
pnpm i
|
pnpm i
|
||||||
pnpm check ${{ matrix.target }}
|
pnpm check ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Release Alpha Version
|
||||||
|
pnpm release-alpha-version
|
||||||
|
|
||||||
- name: Tauri build
|
- name: Tauri build
|
||||||
uses: tauri-apps/tauri-action@v0
|
uses: tauri-apps/tauri-action@v0
|
||||||
env:
|
env:
|
||||||
@ -312,6 +315,9 @@ jobs:
|
|||||||
pnpm i
|
pnpm i
|
||||||
pnpm check ${{ matrix.target }}
|
pnpm check ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Release Alpha Version
|
||||||
|
pnpm release-alpha-version
|
||||||
|
|
||||||
- name: "Setup for linux"
|
- name: "Setup for linux"
|
||||||
run: |-
|
run: |-
|
||||||
sudo ls -lR /etc/apt/
|
sudo ls -lR /etc/apt/
|
||||||
@ -432,6 +438,9 @@ jobs:
|
|||||||
pnpm i
|
pnpm i
|
||||||
pnpm check ${{ matrix.target }}
|
pnpm check ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Release Alpha Version
|
||||||
|
pnpm release-alpha-version
|
||||||
|
|
||||||
- name: Download WebView2 Runtime
|
- name: Download WebView2 Runtime
|
||||||
run: |
|
run: |
|
||||||
invoke-webrequest -uri https://github.com/westinyang/WebView2RuntimeArchive/releases/download/109.0.1518.78/Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -outfile Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab
|
invoke-webrequest -uri https://github.com/westinyang/WebView2RuntimeArchive/releases/download/109.0.1518.78/Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -outfile Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
"updater-fixed-webview2": "node scripts/updater-fixed-webview2.mjs",
|
"updater-fixed-webview2": "node scripts/updater-fixed-webview2.mjs",
|
||||||
"portable": "node scripts/portable.mjs",
|
"portable": "node scripts/portable.mjs",
|
||||||
"portable-fixed-webview2": "node scripts/portable-fixed-webview2.mjs",
|
"portable-fixed-webview2": "node scripts/portable-fixed-webview2.mjs",
|
||||||
"fix-alpha-version": "node scripts/alpha_version.mjs",
|
"fix-alpha-version": "node scripts/fix-alpha_version.mjs",
|
||||||
|
"release-alpha-version": "node scripts/release-alpha_version.mjs",
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"clean": "cd ./src-tauri && cargo clean && cd -"
|
"clean": "cd ./src-tauri && cargo clean && cd -"
|
||||||
},
|
},
|
||||||
|
40
scripts/release-alpha_version.mjs
Normal file
40
scripts/release-alpha_version.mjs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import fs from "fs/promises";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string 传入格式化后的hash
|
||||||
|
* 将新的版本号写入文件 package.json
|
||||||
|
*/
|
||||||
|
async function updatePackageVersion() {
|
||||||
|
// 获取内容根目录
|
||||||
|
const _dirname = process.cwd();
|
||||||
|
const packageJsonPath = path.join(_dirname, "package.json");
|
||||||
|
try {
|
||||||
|
// 读取文件
|
||||||
|
const data = await fs.readFile(packageJsonPath, "utf8");
|
||||||
|
const packageJson = JSON.parse(data);
|
||||||
|
|
||||||
|
let result = packageJson.version;
|
||||||
|
const newVersion = result;
|
||||||
|
|
||||||
|
// Check if version includes 'alpha'
|
||||||
|
if (!result.includes("alpha")) {
|
||||||
|
// If not, append -alpha to the version
|
||||||
|
result = `${result}-alpha`;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("[INFO]: Current version is: ", result);
|
||||||
|
packageJson.version = result;
|
||||||
|
// 写入版本号
|
||||||
|
await fs.writeFile(
|
||||||
|
packageJsonPath,
|
||||||
|
JSON.stringify(packageJson, null, 2),
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
console.log(`[INFO]: Alpha version update to: ${newVersion}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("pnpm run fix-alpha-version ERROR", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePackageVersion().catch(console.error);
|
Loading…
x
Reference in New Issue
Block a user