From 95b866c9365792c274452ccaa4964eaf38e58d5a Mon Sep 17 00:00:00 2001 From: Master_Gui <1436001938@qq.com> Date: Wed, 12 Nov 2025 18:52:19 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E4=BF=AE=E6=AD=A3ISSUE=5FTEMPLATE?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/{.github => }/ISSUE_TEMPLATE/bug_report.yaml | 0 .github/{.github => }/ISSUE_TEMPLATE/config.yml | 0 .github/{.github => }/ISSUE_TEMPLATE/documentation.yml | 0 .github/{.github => }/ISSUE_TEMPLATE/enhancement.yml | 0 .github/{.github => }/ISSUE_TEMPLATE/feature-request.yml | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename .github/{.github => }/ISSUE_TEMPLATE/bug_report.yaml (100%) rename .github/{.github => }/ISSUE_TEMPLATE/config.yml (100%) rename .github/{.github => }/ISSUE_TEMPLATE/documentation.yml (100%) rename .github/{.github => }/ISSUE_TEMPLATE/enhancement.yml (100%) rename .github/{.github => }/ISSUE_TEMPLATE/feature-request.yml (100%) diff --git a/.github/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml similarity index 100% rename from .github/.github/ISSUE_TEMPLATE/bug_report.yaml rename to .github/ISSUE_TEMPLATE/bug_report.yaml diff --git a/.github/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml similarity index 100% rename from .github/.github/ISSUE_TEMPLATE/config.yml rename to .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/.github/ISSUE_TEMPLATE/documentation.yml b/.github/ISSUE_TEMPLATE/documentation.yml similarity index 100% rename from .github/.github/ISSUE_TEMPLATE/documentation.yml rename to .github/ISSUE_TEMPLATE/documentation.yml diff --git a/.github/.github/ISSUE_TEMPLATE/enhancement.yml b/.github/ISSUE_TEMPLATE/enhancement.yml similarity index 100% rename from .github/.github/ISSUE_TEMPLATE/enhancement.yml rename to .github/ISSUE_TEMPLATE/enhancement.yml diff --git a/.github/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml similarity index 100% rename from .github/.github/ISSUE_TEMPLATE/feature-request.yml rename to .github/ISSUE_TEMPLATE/feature-request.yml From 345dfa70f85dae445f05e9c56faf5a699e6f52bd Mon Sep 17 00:00:00 2001 From: Master_Gui <1436001938@qq.com> Date: Wed, 12 Nov 2025 18:54:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?ci:=20=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sync-templates.yml | 81 ++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/sync-templates.yml diff --git a/.github/workflows/sync-templates.yml b/.github/workflows/sync-templates.yml new file mode 100644 index 0000000..fcff385 --- /dev/null +++ b/.github/workflows/sync-templates.yml @@ -0,0 +1,81 @@ +name: Sync Issue Templates +on: + schedule: + # 每周一凌晨0点(UTC时间)自动同步,相当于北京时间周一早上8点 + - cron: '0 0 * * 1' + workflow_dispatch: # 支持手动触发 + push: + branches: [ main ] + paths: + - '.github/workflows/sync-templates.yml' # 当工作流文件本身更新时也触发 + +jobs: + sync-templates: + runs-on: ubuntu-latest + permissions: + contents: write # 需要写入权限来提交更改 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 # 获取所有历史记录,便于推送 + + - name: Set up Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Sync templates from issue-templates repository + run: | + # 克隆模板仓库到临时目录 + git clone https://github.com/Flyleague-Collection/issue-templates temp-templates + + # 确保目标目录存在 + mkdir -p .github/ISSUE_TEMPLATE + + # 备份可能存在的自定义配置文件(如果有的话) + if [ -f ".github/ISSUE_TEMPLATE/config.yml" ]; then + cp .github/ISSUE_TEMPLATE/config.yml config-backup.yml + fi + + # 复制所有模板文件(排除可能不需要的文件) + cp -r temp-templates/.github/ISSUE_TEMPLATE/* .github/ISSUE_TEMPLATE/ || true + + # 如果有备份的配置文件,恢复它(保持仓库特定的配置) + if [ -f "config-backup.yml" ]; then + cp config-backup.yml .github/ISSUE_TEMPLATE/config.yml + rm config-backup.yml + fi + + # 清理临时目录 + rm -rf temp-templates + + - name: Check for changes + id: changes + run: | + # 检查是否有文件变更 + if git diff --quiet; then + echo "changes=false" >> $GITHUB_OUTPUT + echo "🔄 没有检测到模板变更" + else + echo "changes=true" >> $GITHUB_OUTPUT + echo "📝 检测到模板变更" + git status + git diff --name-only + fi + + - name: Commit and push if changes + if: steps.changes.outputs.changes == 'true' + run: | + git add .github/ISSUE_TEMPLATE/ + git commit -m "🔁 chore: 自动同步最新的 issue 模板 [skip ci]" + git push origin main + + echo "✅ 模板同步完成并已提交" + + - name: No changes + if: steps.changes.outputs.changes == 'false' + run: | + echo "✅ 模板已是最新版本,无需更新" \ No newline at end of file From 92a43973de935970bb8a205e123d42facbed4022 Mon Sep 17 00:00:00 2001 From: Master_Gui <1436001938@qq.com> Date: Wed, 12 Nov 2025 18:55:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?ci:=20=E4=BF=AE=E5=A4=8Dauto=20Release?= =?UTF-8?q?=E5=B1=82=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 49 ++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4bd1bec..5f37c23 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,32 @@ - # 导出 build 分支且只包含其文件,防止 workflow 污染 - +name: Create Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get latest tag and next version + id: versions + run: | + # 获取最新标签 + latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") + echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT + + # 生成下一个版本(基于时间戳) + next_version="v$(date +%Y%m%d%H%M%S)" + echo "next_version=$next_version" >> $GITHUB_OUTPUT + - name: Prepare build branch for release artifacts run: | rm -rf build_files @@ -28,17 +55,21 @@ - name: Advanced release note formatting and empty artifact checks id: generate_body run: | - last_tag="${{ steps.latest_tag.outputs.value }}" - version="${{ steps.next_version.outputs.value }}" + last_tag="${{ steps.versions.outputs.latest_tag }}" + version="${{ steps.versions.outputs.next_version }}" n_commit=$(git log "$last_tag"..HEAD --pretty=format:"%h" | wc -l) n_contrib=$(git log "$last_tag"..HEAD --pretty=format:"%an" | sort | uniq | wc -l) body="${version} 最新发行版\n\n本次更新共 ${n_commit} 个 commit,${n_contrib} 位贡献者。\n\n---\n" - # ... 分组 commit 分类 shell 如你现有 … + + # 如果有commit分类逻辑可以在这里添加 + # body+="分组commit内容..." + body+="\n---\n" body+="### 贡献者\n" - git log "$last_tag"..HEAD --pretty=format:"%an" | sort | uniq | awk '{print "- " $0}' >> contributors.txt + git log "$last_tag"..HEAD --pretty=format:"%an" | sort | uniq | awk '{print "- " $0}' > contributors.txt body+="$(cat contributors.txt)\n" body+="\n---\n" + # 附件格式优化 size=$(cat build-artifacts.size) hash=$(cat build-artifacts.sha256) @@ -60,9 +91,9 @@ - name: Create & Publish Release With Artifact uses: ncipollo/release-action@v1 with: - tag: ${{ steps.next_version.outputs.value }} - name: "Operating-document ${{ steps.next_version.outputs.value }} 最新发行版" + tag: ${{ steps.versions.outputs.next_version }} + name: "Operating-document ${{ steps.versions.outputs.next_version }} 最新发行版" body: ${{ steps.generate_body.outputs.body }} artifacts: build-artifacts.zip draft: false - prerelease: false + prerelease: false \ No newline at end of file