Update Up
This commit is contained in:
+20
-18
@@ -1,4 +1,4 @@
|
|||||||
name: Auto Update JS MD5
|
name: Auto Update JS and JAR MD5
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# 监听代码推送
|
# 监听代码推送
|
||||||
@@ -6,7 +6,8 @@ on:
|
|||||||
# 只有当 .js 文件发生变化时才触发,避免无意义运行
|
# 只有当 .js 文件发生变化时才触发,避免无意义运行
|
||||||
paths:
|
paths:
|
||||||
- '**.js'
|
- '**.js'
|
||||||
- '.github/workflows/md5.yml' # 方便调试脚本本身
|
- '**.jar'
|
||||||
|
- '.github/workflows/md5.yml'
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -16,38 +17,39 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # 获取完整历史,方便提交
|
fetch-depth: 0 # 获取完整历史,方便提交
|
||||||
|
|
||||||
- name: 🧮 Calculate & Update MD5
|
- name: Calculate & Update MD5
|
||||||
run: |
|
run: |
|
||||||
echo "开始扫描所有 .js 文件..."
|
echo "Start scanning all .js and .jar files..."
|
||||||
|
|
||||||
find . -type f -name "*.js" -not -path '*/.git/*' | while read -r file; do
|
# Match both .js and .jar files
|
||||||
|
find . -type f \( -name "*.js" -o -name "*.jar" \) -not -path '*/.git/*' | while read -r file; do
|
||||||
|
|
||||||
current_md5=$(md5sum "$file" | awk '{print $1}')
|
currentMd5=$(md5sum "$file" | awk '{print $1}')
|
||||||
|
targetFile="${file}.md5"
|
||||||
|
|
||||||
target_file="${file}.md5"
|
echo "$currentMd5" > "$targetFile"
|
||||||
|
|
||||||
echo "$current_md5" > "$target_file"
|
|
||||||
|
|
||||||
echo "✅ 已更新: $target_file -> $current_md5"
|
echo "Updated: $targetFile -> $currentMd5"
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: 📤 Commit & Push Changes
|
- name: Commit & Push Changes
|
||||||
run: |
|
run: |
|
||||||
# 配置机器人身份
|
# Configure bot identity
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
git add **/*.js.md5
|
# Stage both js and jar md5 files
|
||||||
|
git add **/*.js.md5 **/*.jar.md5
|
||||||
|
|
||||||
if ! git diff-index --quiet HEAD; then
|
if ! git diff-index --quiet HEAD; then
|
||||||
git commit -m "Update md5"
|
git commit -m "Update md5 for js and jar files"
|
||||||
git push
|
git push
|
||||||
echo "::notice::🚀 MD5 文件已更新并推送!"
|
echo "::notice::MD5 files updated and pushed."
|
||||||
else
|
else
|
||||||
echo "::notice::⚠️ MD5 值没有变化,跳过提交。"
|
echo "::notice::No changes in MD5 values, skipping commit."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user