From 6b57607926096db62f1610a39f9aea9fb134d62d Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Tue, 5 Aug 2025 23:12:15 +0800 Subject: [PATCH] fix: update autobuild versioning logic and improve asset checking regex --- .github/workflows/autobuild.yml | 7 ++++--- scripts/release-version.mjs | 8 +++++--- src/pages/profiles.tsx | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index a6a0e9aec..81f7a9c59 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -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') MONTH=$(date +%m) DAY=$(date +%d) - # EXPECTED_VERSION="${CURRENT_BASE_VERSION}+autobuild.${MONTH}${DAY}.${CURRENT_COMMIT}" - EXPECTED_VERSION="${CURRENT_COMMIT}" + EXPECTED_VERSION="${CURRENT_BASE_VERSION}+autobuild.${MONTH}${DAY}.${CURRENT_COMMIT}" echo "🏷️ Expected autobuild version: $EXPECTED_VERSION" # Check if autobuild release exists and has assets for current version 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 echo "📦 Existing assets:" diff --git a/scripts/release-version.mjs b/scripts/release-version.mjs index d1533f513..a41e0e358 100644 --- a/scripts/release-version.mjs +++ b/scripts/release-version.mjs @@ -174,16 +174,18 @@ async function updateTauriConfigVersion(newVersion) { "[INFO]: Current tauri.conf.json version is: ", tauriConfig.version, ); - + // 使用完整版本信息,包含build metadata tauriConfig.version = versionWithoutV; - + await fs.writeFile( tauriConfigPath, JSON.stringify(tauriConfig, null, 2), "utf8", ); - console.log(`[INFO]: tauri.conf.json version updated to: ${versionWithoutV}`); + console.log( + `[INFO]: tauri.conf.json version updated to: ${versionWithoutV}`, + ); } catch (error) { console.error("Error updating tauri.conf.json version:", error); throw error; diff --git a/src/pages/profiles.tsx b/src/pages/profiles.tsx index f3e01a2d8..0eb811a5c 100644 --- a/src/pages/profiles.tsx +++ b/src/pages/profiles.tsx @@ -33,6 +33,7 @@ import { updateProfile, reorderProfile, createProfile, + getProfiles, } from "@/services/cmds"; import { useSetLoadingCache, useThemeMode } from "@/services/states"; import { closeAllConnections } from "@/services/cmds"; @@ -356,14 +357,14 @@ const ProfilePage = () => { await mutate("getProfiles", getProfiles(), { revalidate: true }); await onEnhance(false); showNotice( - "warning", + "error", t("Profile imported but may need manual refresh"), 3000, ); } catch (finalError) { console.error(`[导入刷新] 最终刷新尝试失败:`, finalError); showNotice( - "warning", + "error", t("Profile imported successfully, please restart if not visible"), 5000, );