refactor: streamline clean old assets job by using reusable workflow

refactor: update clean old assets job to include steps section

refactor: add checkout step in clean_old_assets job for improved repository access

fix: correct path to clean old assets workflow in autobuild.yml

fix: update path to clean old assets workflow in autobuild.yml

refactor: simplify clean_old_assets job by removing unnecessary steps

refactor: enhance clean_old_assets job dependencies for improved execution flow

Revert "refactor: enhance clean_old_assets job dependencies for improved execution flow"

This reverts commit 1a5108b5ad.

feat: implement get_latest_tauri_commit script and update release versioning logic
This commit is contained in:
Tunglies
2025-08-13 16:48:48 +08:00
parent 331e4a4970
commit 1e2b453c24
4 changed files with 116 additions and 79 deletions

View File

@@ -6,9 +6,10 @@
*
* <version> can be:
* - A full semver version (e.g., 1.2.3, v1.2.3, 1.2.3-beta, v1.2.3+build)
* - A tag: "alpha", "beta", "rc", "autobuild", or "deploytest"
* - A tag: "alpha", "beta", "rc", "autobuild", "autobuild-latest", or "deploytest"
* - "alpha", "beta", "rc": Appends the tag to the current base version (e.g., 1.2.3-beta)
* - "autobuild": Appends a timestamped autobuild tag (e.g., 1.2.3+autobuild.2406101530)
* - "autobuild-latest": Appends an autobuild tag with latest Tauri commit (e.g., 1.2.3+autobuild.0614.a1b2c3d)
* - "deploytest": Appends a timestamped deploytest tag (e.g., 1.2.3+deploytest.2406101530)
*
* Examples:
@@ -16,6 +17,7 @@
* pnpm release-version v1.2.3-beta
* pnpm release-version beta
* pnpm release-version autobuild
* pnpm release-version autobuild-latest
* pnpm release-version deploytest
*
* The script will:
@@ -45,6 +47,24 @@ function getGitShortCommit() {
}
}
/**
* 获取最新 Tauri 相关提交的短 hash
* @returns {string}
*/
function getLatestTauriCommit() {
try {
const fullHash = execSync("./scripts-workflow/get_latest_tauri_commit.bash")
.toString()
.trim();
return execSync(`git rev-parse --short ${fullHash}`).toString().trim();
} catch (e) {
console.warn(
"[WARN]: Failed to get latest Tauri commit, fallback to current git short commit",
);
return getGitShortCommit();
}
}
/**
* 生成短时间戳格式YYMMDD或带 commit格式YYMMDD.cc39b27
* @param {boolean} withCommit 是否带 commit
@@ -219,7 +239,14 @@ async function main(versionArg) {
try {
let newVersion;
const validTags = ["alpha", "beta", "rc", "autobuild", "deploytest"];
const validTags = [
"alpha",
"beta",
"rc",
"autobuild",
"autobuild-latest",
"deploytest",
];
if (validTags.includes(versionArg.toLowerCase())) {
const currentVersion = await getCurrentVersion();
@@ -228,6 +255,10 @@ async function main(versionArg) {
if (versionArg.toLowerCase() === "autobuild") {
// 格式: 2.3.0+autobuild.250613.cc39b27
newVersion = `${baseVersion}+autobuild.${generateShortTimestamp(true)}`;
} else if (versionArg.toLowerCase() === "autobuild-latest") {
// 格式: 2.3.0+autobuild.0614.a1b2c3d (使用最新 Tauri 提交)
const latestTauriCommit = getLatestTauriCommit();
newVersion = `${baseVersion}+autobuild.${generateShortTimestamp()}.${latestTauriCommit}`;
} else if (versionArg.toLowerCase() === "deploytest") {
// 格式: 2.3.0+deploytest.250613.cc39b27
newVersion = `${baseVersion}+deploytest.${generateShortTimestamp(true)}`;