fix: update autobuild versioning logic and improve asset checking regex

This commit is contained in:
Tunglies
2025-08-05 23:12:15 +08:00
Unverified
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')
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:"

View File

@@ -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;

View File

@@ -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,
);