Update alpha workflow to trigger on src directory changes

This commit is contained in:
Tunglies
2025-03-29 12:35:49 +08:00
parent a9cccc7b97
commit 9ebde802d4
5 changed files with 32 additions and 21 deletions

View File

@@ -85,7 +85,8 @@ pub async fn patch_profiles_config(profiles: IProfiles) -> CmdResult<bool> {
// 更新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, _)) => {

View File

@@ -154,6 +154,8 @@ impl Config {
chain_logs: logs,
};
println!("generate runtime draft");
Ok(())
}
}

View File

@@ -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)]

View File

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