From 73df1977329e7912fd7bab81e06c5fb5325cbeb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BE=89=E9=B8=AD=E8=9B=8B?= Date: Fri, 5 Sep 2025 01:04:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=8E=E5=8C=96=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_release_branch.yml | 45 ++++++++++++++++------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build_release_branch.yml b/.github/workflows/build_release_branch.yml index fe49f46c9..8a0151176 100644 --- a/.github/workflows/build_release_branch.yml +++ b/.github/workflows/build_release_branch.yml @@ -16,53 +16,74 @@ jobs: actions: read steps: - - name: Checkout repository + - name: 📥 检出代码仓库 uses: actions/checkout@v4 with: path: bettergi-scripts-list - - name: Setup Node.js + - name: 🚀 配置 Node.js 环境 uses: actions/setup-node@v4 with: node-version: '22' - - name: Build project + - name: 🔨 构建项目并生成文件 run: | + echo "🔄 开始构建项目..." cd bettergi-scripts-list + echo "📦 执行构建脚本 (强制模式 + Gzip压缩)" node ./build/build.js --force --gzip + echo "✅ 项目构建完成" - - name: Copy generated files + - name: 📋 复制生成的文件到工作目录 run: | + echo "📂 复制 repo.json 和 repo.json.gz 文件..." cp bettergi-scripts-list/repo.json . cp bettergi-scripts-list/repo.json.gz . + echo "✅ 文件复制完成" + ls -la *.json* - - name: Discard changes in bettergi-scripts-list + - name: 🧹 清理工作目录变更 run: | + echo "🔄 清理 bettergi-scripts-list 目录中的变更..." cd bettergi-scripts-list git checkout -- . git clean -fd + echo "✅ 工作目录清理完成" - - name: Reset and switch to release branch + - name: ⚙️ 配置 Git 用户信息 run: | + echo "🔧 配置 Git 用户身份信息..." + cd bettergi-scripts-list + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + echo "✅ Git 用户信息配置完成" + + - name: 🌿 准备 Release 分支 + run: | + echo "🔄 开始准备 Release 分支..." cd bettergi-scripts-list - # 删除本地release分支(如果存在) + echo "🗑️ 删除本地 release 分支(如果存在)" git branch -D release || true - # 创建新的orphan分支 + echo "🆕 创建新的 orphan 分支" git checkout --orphan release - # 将main分支的内容检出到工作区 + echo "📦 检出 main 分支的内容到工作区" git checkout main -- repo .gitignore - # 复制生成好的repo.json文件 + echo "📋 复制生成的文件到 release 分支" cp ../repo.json . cp ../repo.json.gz . + + echo "📊 显示当前文件状态" + ls -la + echo "✅ Release 分支准备完成" - - name: Commit and push to release branch + - name: 🚀 提交并推送到 Release 分支 uses: stefanzweifel/git-auto-commit-action@v5 with: - commit_message: "reset the release branch" + commit_message: "🔄 重置 release 分支 - 自动构建于 $(date '+%Y-%m-%d %H:%M:%S')" branch: release push_options: '--force' repository: bettergi-scripts-list \ No newline at end of file