fix: update autobuild versioning logic and improve asset checking regex

This commit is contained in:
Tunglies
2025-08-05 23:12:15 +08:00
parent c3675e48fd
commit 6b57607926
3 changed files with 12 additions and 8 deletions

View File

@@ -77,13 +77,14 @@ jobs:
CURRENT_BASE_VERSION=$(echo "$CURRENT_VERSION" | sed -E 's/-(alpha|beta|rc)(\.[0-9]+)?//g' | sed -E 's/\+[a-zA-Z0-9.-]+//g') CURRENT_BASE_VERSION=$(echo "$CURRENT_VERSION" | sed -E 's/-(alpha|beta|rc)(\.[0-9]+)?//g' | sed -E 's/\+[a-zA-Z0-9.-]+//g')
MONTH=$(date +%m) MONTH=$(date +%m)
DAY=$(date +%d) DAY=$(date +%d)
# EXPECTED_VERSION="${CURRENT_BASE_VERSION}+autobuild.${MONTH}${DAY}.${CURRENT_COMMIT}" EXPECTED_VERSION="${CURRENT_BASE_VERSION}+autobuild.${MONTH}${DAY}.${CURRENT_COMMIT}"
EXPECTED_VERSION="${CURRENT_COMMIT}"
echo "🏷️ Expected autobuild version: $EXPECTED_VERSION" echo "🏷️ Expected autobuild version: $EXPECTED_VERSION"
# Check if autobuild release exists and has assets for current version # Check if autobuild release exists and has assets for current version
echo "🔍 Checking if autobuild assets already exist..." echo "🔍 Checking if autobuild assets already exist..."
EXISTING_ASSETS=$(gh release view "${{ env.TAG_NAME }}" --json assets -q '.assets[].name' 2>/dev/null | grep -E "${EXPECTED_VERSION//+/\\+}" || true) # Escape special characters in version for regex matching
EXPECTED_VERSION_ESCAPED=$(echo "$EXPECTED_VERSION" | sed 's/[+.]/\\&/g')
EXISTING_ASSETS=$(gh release view "${{ env.TAG_NAME }}" --json assets -q '.assets[].name' 2>/dev/null | grep -E "${EXPECTED_VERSION_ESCAPED}" || true)
if [ -n "$EXISTING_ASSETS" ]; then if [ -n "$EXISTING_ASSETS" ]; then
echo "📦 Existing assets:" echo "📦 Existing assets:"

View File

@@ -174,16 +174,18 @@ async function updateTauriConfigVersion(newVersion) {
"[INFO]: Current tauri.conf.json version is: ", "[INFO]: Current tauri.conf.json version is: ",
tauriConfig.version, tauriConfig.version,
); );
// 使用完整版本信息包含build metadata // 使用完整版本信息包含build metadata
tauriConfig.version = versionWithoutV; tauriConfig.version = versionWithoutV;
await fs.writeFile( await fs.writeFile(
tauriConfigPath, tauriConfigPath,
JSON.stringify(tauriConfig, null, 2), JSON.stringify(tauriConfig, null, 2),
"utf8", "utf8",
); );
console.log(`[INFO]: tauri.conf.json version updated to: ${versionWithoutV}`); console.log(
`[INFO]: tauri.conf.json version updated to: ${versionWithoutV}`,
);
} catch (error) { } catch (error) {
console.error("Error updating tauri.conf.json version:", error); console.error("Error updating tauri.conf.json version:", error);
throw error; throw error;

View File

@@ -33,6 +33,7 @@ import {
updateProfile, updateProfile,
reorderProfile, reorderProfile,
createProfile, createProfile,
getProfiles,
} from "@/services/cmds"; } from "@/services/cmds";
import { useSetLoadingCache, useThemeMode } from "@/services/states"; import { useSetLoadingCache, useThemeMode } from "@/services/states";
import { closeAllConnections } from "@/services/cmds"; import { closeAllConnections } from "@/services/cmds";
@@ -356,14 +357,14 @@ const ProfilePage = () => {
await mutate("getProfiles", getProfiles(), { revalidate: true }); await mutate("getProfiles", getProfiles(), { revalidate: true });
await onEnhance(false); await onEnhance(false);
showNotice( showNotice(
"warning", "error",
t("Profile imported but may need manual refresh"), t("Profile imported but may need manual refresh"),
3000, 3000,
); );
} catch (finalError) { } catch (finalError) {
console.error(`[导入刷新] 最终刷新尝试失败:`, finalError); console.error(`[导入刷新] 最终刷新尝试失败:`, finalError);
showNotice( showNotice(
"warning", "error",
t("Profile imported successfully, please restart if not visible"), t("Profile imported successfully, please restart if not visible"),
5000, 5000,
); );