Files
clash-proxy/scripts-workflow/get_latest_tauri_commit.bash
Tunglies 1e2b453c24 refactor: streamline clean old assets job by using reusable workflow
refactor: update clean old assets job to include steps section

refactor: add checkout step in clean_old_assets job for improved repository access

fix: correct path to clean old assets workflow in autobuild.yml

fix: update path to clean old assets workflow in autobuild.yml

refactor: simplify clean_old_assets job by removing unnecessary steps

refactor: enhance clean_old_assets job dependencies for improved execution flow

Revert "refactor: enhance clean_old_assets job dependencies for improved execution flow"

This reverts commit 1a5108b5ad.

feat: implement get_latest_tauri_commit script and update release versioning logic
2025-08-14 20:42:24 +08:00

56 lines
1.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 获取最近一个和 Tauri 相关的改动的 commit hash
# This script finds the latest commit that modified Tauri-related files
# Tauri 相关文件的模式
TAURI_PATTERNS=(
"src-tauri/"
"Cargo.toml"
"Cargo.lock"
"tauri.*.conf.json"
"package.json"
"pnpm-lock.yaml"
"src/"
)
# 排除的文件模式build artifacts 等)
EXCLUDE_PATTERNS=(
"src-tauri/target/"
"src-tauri/gen/"
"*.log"
"*.tmp"
"node_modules/"
".git/"
)
# 构建 git log 的路径过滤参数
PATHS=""
for pattern in "${TAURI_PATTERNS[@]}"; do
if [[ -e "$pattern" ]]; then
PATHS="$PATHS $pattern"
fi
done
# 如果没有找到相关路径,返回错误
if [[ -z "$PATHS" ]]; then
echo "Error: No Tauri-related paths found in current directory" >&2
exit 1
fi
# 获取最新的 commit hash
# 使用 git log 查找最近修改了 Tauri 相关文件的提交
LATEST_COMMIT=$(git log --format="%H" -n 1 -- $PATHS)
# 验证是否找到了 commit
if [[ -z "$LATEST_COMMIT" ]]; then
echo "Error: No commits found for Tauri-related files" >&2
exit 1
fi
# 输出结果
echo "$LATEST_COMMIT"
# 如果需要更多信息,可以取消注释以下行
# echo "Latest Tauri-related commit: $LATEST_COMMIT"
# git show --stat --oneline "$LATEST_COMMIT"