From 38902c8f8872cadbd0fbe9e5f3eb342b95f1137a Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 6 Sep 2025 20:59:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=92=A4=E5=9B=9E=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-simple.yml | 204 --------------------------- cliff.toml | 90 ------------ 2 files changed, 294 deletions(-) delete mode 100644 .github/workflows/release-simple.yml delete mode 100644 cliff.toml diff --git a/.github/workflows/release-simple.yml b/.github/workflows/release-simple.yml deleted file mode 100644 index 0dc7794a..00000000 --- a/.github/workflows/release-simple.yml +++ /dev/null @@ -1,204 +0,0 @@ -name: 生成 Changelog 并发布版本 - -on: - workflow_dispatch: - push: - tags: - - 'v*' - -permissions: - contents: write - -jobs: - build-and-release: - name: 构建并发布版本 - runs-on: windows-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: 设置 git-cliff - uses: kenji-miyake/setup-git-cliff@v1 - with: - version: latest - - - name: 生成 changelog - id: generate-changelog - run: | - # 检查是否存在详细配置文件 - if (Test-Path "cliff-detailed.toml") { - Write-Host "使用详细 changelog 配置" - git-cliff --config cliff-detailed.toml --output CHANGELOG.md - } else { - Write-Host "使用默认 changelog 配置" - git-cliff --output CHANGELOG.md - } - - # 如果生成的 changelog 为空或只有标题,创建手动 changelog - $changelogContent = Get-Content CHANGELOG.md -Raw - if ($changelogContent -match "^# Changelog\s*$" -or $changelogContent.Length -lt 100) { - Write-Host "Changelog 内容较少,生成手动 changelog" - $version = $env:GITHUB_REF_NAME - $date = Get-Date -Format "yyyy-MM-dd" - - $manualChangelog = @" -# Changelog - -## [$version] - $date - -### 📋 Other -- **发行说明测试** *(Release Notes Test)* - - 👤 **提交者**: GitHub Actions - - 🕒 **提交时间**: $date - - 🔗 **提交哈希**: [$(git rev-parse --short HEAD)](https://github.com/InkCanvasForClass/community/commit/$(git rev-parse HEAD)) - - 📝 **完整消息**: 发行说明测试 - -### 🚀 新功能 (New Features) -- 新增 GitHub Actions 自动发布工作流 -- 新增详细的 Changelog 生成功能 -- 新增多平台构建支持 -- 新增 SHA256 校验值计算 - -### 🔧 改进 (Improvements) -- 改进发布流程自动化 -- 改进 Changelog 格式和内容 -- 改进构建产物管理 - -### 🐛 修复 (Bug Fixes) -- 修复发布工作流配置问题 -- 修复 Changelog 生成问题 - -### 📚 文档 (Documentation) -- 更新 README 文档 -- 添加发布说明模板 -- 完善工作流配置说明 - -"@ - $manualChangelog | Out-File -FilePath CHANGELOG.md -Encoding UTF8 - } - - Write-Host "Changelog 生成完成" - Get-Content CHANGELOG.md - - - name: Setup MSbuild - uses: microsoft/setup-msbuild@v2 - - - name: Setup NuGet - uses: NuGet/setup-nuget@v2.0.1 - - - name: Restore NuGet Packages - run: nuget restore "Ink Canvas.sln" - - - name: Build the Solution - run: | - msbuild -t:restore /p:GitFlow="Github Action" - msbuild /p:platform="Any CPU" /p:configuration="Release" /p:GitFlow="Github Action" "Ink Canvas/InkCanvasForClass.csproj" - - - name: 准备发布文件 - run: | - Write-Host "准备发布目录..." - New-Item -ItemType Directory -Path "release" -Force - - # 复制构建产物到临时目录 - $tempDir = "temp-build" - New-Item -ItemType Directory -Path $tempDir -Force - xcopy "Ink Canvas\bin\Any CPU\Release\net472\*" "$tempDir\" /E /I /Y - - Write-Host "构建产物整理完成" - Get-ChildItem $tempDir - - # 创建压缩包 - $zipName = "InkCanvasForClass.CE.$env:GITHUB_REF_NAME.zip" - Write-Host "创建压缩包: $zipName" - Compress-Archive -Path "$tempDir\*" -DestinationPath "release\$zipName" -Force - - # 清理临时目录 - Remove-Item -Path $tempDir -Recurse -Force - - Write-Host "发布文件准备完成" - Get-ChildItem release - - - name: 计算 SHA256 值 - run: | - Write-Host "开始计算SHA256校验值..." - Set-Location release - "" | Out-File -FilePath SHA256SUMS.txt -Encoding UTF8 - Get-ChildItem -Recurse -File | Where-Object { $_.Name -ne "SHA256SUMS.txt" } | ForEach-Object { - Write-Host "计算 $($_.Name) 的SHA256值..." - $hash = (Get-FileHash $_.FullName -Algorithm SHA256).Hash - "$hash $($_.Name)" | Add-Content -Path SHA256SUMS.txt - } - Write-Host "SHA256校验值计算完成:" - Get-Content SHA256SUMS.txt - - - name: 验证 SHA256SUMS.txt 文件 - run: | - Write-Host "验证SHA256SUMS.txt文件..." - Set-Location release - if (-not (Test-Path "SHA256SUMS.txt")) { - Write-Error "错误:在release目录中未找到SHA256SUMS.txt文件" - exit 1 - } - if ((Get-Item "SHA256SUMS.txt").Length -eq 0) { - Write-Error "错误:SHA256SUMS.txt文件为空" - exit 1 - } - Write-Host "SHA256SUMS.txt文件验证通过" - Set-Location .. - - - name: 生成 需发布 的表格信息 - run: | - Set-Location release - "" | Add-Content -Path ..\CHANGELOG.md - "Full Changelog: [1.7.9.0...$env:GITHUB_REF_NAME](https://github.com/InkCanvasForClass/community/compare/1.7.9.0...$env:GITHUB_REF_NAME)" | Add-Content -Path ..\CHANGELOG.md - "" | Add-Content -Path ..\CHANGELOG.md - "**国内 下载链接**" | Add-Content -Path ..\CHANGELOG.md - "| 平台/打包方式 | 支持架构 | 完整版 |" | Add-Content -Path ..\CHANGELOG.md - "| --- | --- | --- |" | Add-Content -Path ..\CHANGELOG.md - "| Windows (inkeys) | Any CPU | [下载 $env:GITHUB_REF_NAME](https://iccce.inkeys.top/Release/InkCanvasForClass.CE.$env:GITHUB_REF_NAME.zip) |" | Add-Content -Path ..\CHANGELOG.md - "| Windows (智教联盟) | Any CPU | [下载 $env:GITHUB_REF_NAME](https://get.smart-teach.cn/d/Ningbo-S3/shared/jiangling/community/InkCanvasForClass.CE.$env:GITHUB_REF_NAME.zip) |" | Add-Content -Path ..\CHANGELOG.md - "" | Add-Content -Path ..\CHANGELOG.md - "**Github 镜像 下载链接**" | Add-Content -Path ..\CHANGELOG.md - "| 镜像源 | 平台/打包方式 | 支持架构 | 完整版 |" | Add-Content -Path ..\CHANGELOG.md - "| --- | --- | --- | --- |" | Add-Content -Path ..\CHANGELOG.md - "| ghfast.top | Windows 目录模式 | Any CPU | [下载 $env:GITHUB_REF_NAME](https://ghfast.top/https://github.com/InkCanvasForClass/community/releases/download/$env:GITHUB_REF_NAME/InkCanvasForClass.CE.$env:GITHUB_REF_NAME.zip) |" | Add-Content -Path ..\CHANGELOG.md - "| gh-proxy.com | Windows 目录模式 | Any CPU | [下载 $env:GITHUB_REF_NAME](https://gh-proxy.com/https://github.com/InkCanvasForClass/community/releases/download/$env:GITHUB_REF_NAME/InkCanvasForClass.CE.$env:GITHUB_REF_NAME.zip) |" | Add-Content -Path ..\CHANGELOG.md - "| bgithub.xyz | Windows 目录模式 | Any CPU | [下载 $env:GITHUB_REF_NAME](https://bgithub.xyz/InkCanvasForClass/community/releases/download/$env:GITHUB_REF_NAME/InkCanvasForClass.CE.$env:GITHUB_REF_NAME.zip) |" | Add-Content -Path ..\CHANGELOG.md - "| kkgithub.com | Windows 目录模式 | Any CPU | [下载 $env:GITHUB_REF_NAME](https://kkgithub.com/InkCanvasForClass/community/releases/download/$env:GITHUB_REF_NAME/InkCanvasForClass.CE.$env:GITHUB_REF_NAME.zip) |" | Add-Content -Path ..\CHANGELOG.md - "" | Add-Content -Path ..\CHANGELOG.md - "**SHA256 校验值-请核对下载的文件的SHA256值是否正确**" | Add-Content -Path ..\CHANGELOG.md - "| 文件名 | SHA256 值 |" | Add-Content -Path ..\CHANGELOG.md - "| --- | --- |" | Add-Content -Path ..\CHANGELOG.md - Get-Content SHA256SUMS.txt | ForEach-Object { - $parts = $_ -split '\s+', 2 - if ($parts.Length -eq 2) { - "| $($parts[1]) | $($parts[0]) |" | Add-Content -Path ..\CHANGELOG.md - } - } - Remove-Item SHA256SUMS.txt - Set-Location .. - - - name: 确定发布类型 - id: release-type - run: | - if ($env:GITHUB_REF -like "*beta*" -or $env:GITHUB_REF -like "*alpha*") { - Write-Output "is_beta=true" >> $env:GITHUB_ENV - } else { - Write-Output "is_beta=false" >> $env:GITHUB_ENV - } - - - name: 发布 - uses: softprops/action-gh-release@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - files: release/* - body_path: CHANGELOG.md - draft: false - prerelease: ${{ env.is_beta == 'true' }} - tag_name: ${{ github.ref_name }} - name: Ink Canvas For Class CE 新版本 - ${{ github.ref_name }} - fail_on_unmatched_files: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/cliff.toml b/cliff.toml deleted file mode 100644 index 2ce8f3ca..00000000 --- a/cliff.toml +++ /dev/null @@ -1,90 +0,0 @@ -# git-cliff configuration file - 详细版本 -# https://git-cliff.org/docs/configuration - -[changelog] -# changelog header -header = "# Changelog\n\n" -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ -{% if version %}\ -## [{{ version }}] - {{ timestamp | date(format="%Y-%m-%d") }} -{% else %}\ -## [Unreleased] -{% endif %}\ -{% for group, commits in commits | group_by(attribute="group") %} -### {{ group | upper_first }} -{% for commit in commits %} -- **{{ commit.message | upper_first }}**{% if commit.scope %} *({{ commit.scope }})*{% endif %}{% if commit.breaking %} **BREAKING:** {{ commit.breaking_description }}{% endif %} - - 👤 **提交者**: {{ commit.author.name }} - - 🕒 **提交时间**: {{ commit.timestamp | date(format="%Y-%m-%d %H:%M:%S") }} - - 🔗 **提交哈希**: [{{ commit.id | truncate(length=7, end="") }}](https://github.com/InkCanvasForClass/community/commit/{{ commit.id }}) - - 📝 **完整消息**: {{ commit.message }} -{% endfor %} -{% endfor %} -""" - -# template for the changelog footer -footer = "" - -# git-cliff internal behavior -[git] -# parse the commits using this regex -commit_parsers = [ - # 带作用域的提交 - { message = "^feat\\((.+)\\)", group = "✨ Features", scope = "$1" }, - { message = "^fix\\((.+)\\)", group = "🐛 Bug Fixes", scope = "$1" }, - { message = "^docs\\((.+)\\)", group = "📚 Documentation", scope = "$1" }, - { message = "^style\\((.+)\\)", group = "💄 Styling", scope = "$1" }, - { message = "^refactor\\((.+)\\)", group = "♻️ Code Refactoring", scope = "$1" }, - { message = "^perf\\((.+)\\)", group = "⚡ Performance", scope = "$1" }, - { message = "^test\\((.+)\\)", group = "🧪 Tests", scope = "$1" }, - { message = "^build\\((.+)\\)", group = "🔨 Build System", scope = "$1" }, - { message = "^ci\\((.+)\\)", group = "👷 Continuous Integration", scope = "$1" }, - { message = "^chore\\((.+)\\)", group = "🔧 Chores", scope = "$1" }, - { message = "^revert\\((.+)\\)", group = "⏪ Reverts", scope = "$1" }, - { message = "^merge\\((.+)\\)", group = "🔀 Merges", scope = "$1" }, - { message = "^hotfix\\((.+)\\)", group = "🚨 Hotfixes", scope = "$1" }, - { message = "^security\\((.+)\\)", group = "🔒 Security", scope = "$1" }, - { message = "^ui\\((.+)\\)", group = "🎨 UI/UX", scope = "$1" }, - { message = "^api\\((.+)\\)", group = "🔌 API", scope = "$1" }, - { message = "^config\\((.+)\\)", group = "⚙️ Configuration", scope = "$1" }, - { message = "^deps\\((.+)\\)", group = "📦 Dependencies", scope = "$1" }, - - # 不带作用域的提交 - { message = "^feat", group = "✨ Features" }, - { message = "^fix", group = "🐛 Bug Fixes" }, - { message = "^docs", group = "📚 Documentation" }, - { message = "^style", group = "💄 Styling" }, - { message = "^refactor", group = "♻️ Code Refactoring" }, - { message = "^perf", group = "⚡ Performance" }, - { message = "^test", group = "🧪 Tests" }, - { message = "^build", group = "🔨 Build System" }, - { message = "^ci", group = "👷 Continuous Integration" }, - { message = "^chore", group = "🔧 Chores" }, - { message = "^revert", group = "⏪ Reverts" }, - { message = "^merge", group = "🔀 Merges" }, - { message = "^hotfix", group = "🚨 Hotfixes" }, - { message = "^security", group = "🔒 Security" }, - { message = "^ui", group = "🎨 UI/UX" }, - { message = "^api", group = "🔌 API" }, - { message = "^config", group = "⚙️ Configuration" }, - { message = "^deps", group = "📦 Dependencies" }, - - # 其他提交 - { message = "^.*", group = "📋 Other" }, -] -# protect breaking changes from being skipped due to matching a previous commit -protect_breaking_commits = false -# filter out the commits that are not matched by commit parsers -filter_commits = false -# glob pattern for matching tags -tag_pattern = "v[0-9]*" -# regex for skipping tags -skip_tags = "^v0\\.1\\.0$" -# regex for ignoring tags -ignore_tags = "" -# sort the tags topologically -topo_order = false -# sort the commits inside sections by date -sort_commits = "newest" \ No newline at end of file