diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml index f24cfc69..6fcffabe 100644 --- a/.github/workflows/alpha.yml +++ b/.github/workflows/alpha.yml @@ -25,7 +25,7 @@ jobs: with: fetch-depth: 2 - - name: Check if version changed + - name: Check if version changed or src changed id: check run: | # For manual workflow_dispatch, always run @@ -50,8 +50,25 @@ jobs: if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION" echo "should_run=true" >> $GITHUB_OUTPUT + exit 0 + fi + + # Check if src or src-tauri directories changed + CURRENT_SRC_HASH=$(git rev-parse HEAD:src) + PREVIOUS_SRC_HASH=$(git rev-parse HEAD~1:src 2>/dev/null || echo "") + CURRENT_TAURI_HASH=$(git rev-parse HEAD:src-tauri 2>/dev/null || echo "") + PREVIOUS_TAURI_HASH=$(git rev-parse HEAD~1:src-tauri 2>/dev/null || echo "") + + echo "Current src hash: $CURRENT_SRC_HASH" + echo "Previous src hash: $PREVIOUS_SRC_HASH" + echo "Current tauri hash: $CURRENT_TAURI_HASH" + echo "Previous tauri hash: $PREVIOUS_TAURI_HASH" + + if [ "$CURRENT_SRC_HASH" != "$PREVIOUS_SRC_HASH" ] || [ "$CURRENT_TAURI_HASH" != "$PREVIOUS_TAURI_HASH" ]; then + echo "Source directories changed" + echo "should_run=true" >> $GITHUB_OUTPUT else - echo "Version unchanged: $CURRENT_VERSION" + echo "Version and source directories unchanged" echo "should_run=false" >> $GITHUB_OUTPUT fi diff --git a/src-tauri/src/cmd/profile.rs b/src-tauri/src/cmd/profile.rs index b9ebcc4e..25c67a2e 100644 --- a/src-tauri/src/cmd/profile.rs +++ b/src-tauri/src/cmd/profile.rs @@ -85,7 +85,8 @@ pub async fn patch_profiles_config(profiles: IProfiles) -> CmdResult { // 更新profiles配置 logging!(info, Type::Cmd, true, "正在更新配置草稿"); - wrap_err!({ Config::profiles().draft().patch_config(profiles) })?; + let _ = Config::profiles().draft().patch_config(profiles); + // 更新配置并进行验证 match CoreManager::global().update_config().await { Ok((true, _)) => { diff --git a/src-tauri/src/config/config.rs b/src-tauri/src/config/config.rs index 6e32e59c..7aab18e4 100644 --- a/src-tauri/src/config/config.rs +++ b/src-tauri/src/config/config.rs @@ -154,6 +154,8 @@ impl Config { chain_logs: logs, }; + println!("generate runtime draft"); + Ok(()) } } diff --git a/src-tauri/src/config/profiles.rs b/src-tauri/src/config/profiles.rs index 2c4545c9..8d1f7568 100644 --- a/src-tauri/src/config/profiles.rs +++ b/src-tauri/src/config/profiles.rs @@ -1,10 +1,11 @@ use super::{prfitem::PrfItem, PrfOption}; -use crate::utils::{dirs, help}; -use crate::{logging, utils::logging::Type}; +use crate::{ + logging, + utils::{dirs, help, logging::Type}, +}; use anyhow::{bail, Context, Result}; use serde::{Deserialize, Serialize}; -use serde_yaml::Mapping; -use serde_yaml::Value; +use serde_yaml::{Mapping, Value}; use std::{fs, io::Write}; /// Define the `profiles.yaml` schema #[derive(Default, Debug, Clone, Deserialize, Serialize)] diff --git a/src-tauri/src/core/core.rs b/src-tauri/src/core/core.rs index dc73fa3a..bd5e8b69 100644 --- a/src-tauri/src/core/core.rs +++ b/src-tauri/src/core/core.rs @@ -148,8 +148,10 @@ impl CoreManager { } /// 验证运行时配置 pub async fn validate_config(&self) -> Result<(bool, String)> { + logging!(info, Type::Config, true, "生成临时配置文件用于验证"); let config_path = Config::generate_file(ConfigType::Check)?; let config_path = dirs::path_to_str(&config_path)?; + println!("{}", config_path); self.validate_config_internal(config_path).await } /// 验证指定的配置文件 @@ -377,20 +379,8 @@ impl CoreManager { logging!(info, Type::Config, true, "开始更新配置"); // 1. 先生成新的配置内容 - logging!(info, Type::Config, true, "生成新的配置内容"); - Config::generate().await?; - - // 2. 生成临时文件并进行验证 - logging!(info, Type::Config, true, "生成临时配置文件用于验证"); - let temp_config = Config::generate_file(ConfigType::Check)?; - let temp_config = dirs::path_to_str(&temp_config)?; - logging!( - info, - Type::Config, - true, - "临时配置文件路径: {}", - temp_config - ); + // logging!(info, Type::Config, true, "生成新的配置内容"); + // Config::generate().await?; // 3. 验证配置 match self.validate_config().await {