mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-04 16:57:32 +08:00
Update alpha workflow to trigger on src directory changes
This commit is contained in:
parent
a9cccc7b97
commit
9ebde802d4
21
.github/workflows/alpha.yml
vendored
21
.github/workflows/alpha.yml
vendored
@ -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
|
||||
|
||||
|
@ -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, _)) => {
|
||||
|
@ -154,6 +154,8 @@ impl Config {
|
||||
chain_logs: logs,
|
||||
};
|
||||
|
||||
println!("generate runtime draft");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -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)]
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user