[2.11.4] - 2026-02-25

发布时间:2026/7/28 6:47:54
[2.11.4] - 2026-02-25 [2.11.4] - 2026-02-25【免费下载链接】upload-release-actionUpload files to a GitHub release项目地址: https://gitcode.com/gh_mirrors/up/upload-release-actionBump npm versions[2.11.3] - 2025-11-20Post-fix releases created as draft when they shouldnt have - [#99]## 自动集成流程从 CHANGELOG 到 Release 的完整实现 ### 1️⃣ 准备工作创建基本的工作流文件 首先我们需要在项目的 .github/workflows 目录下创建一个工作流文件例如 release.yml。这个文件将定义触发条件、运行环境和具体步骤。 ### 2️⃣ 读取 CHANGELOG.md 内容提取当前版本信息 在工作流中我们需要添加一个步骤来读取 CHANGELOG.md 文件并提取当前版本的变更内容。可以使用以下代码片段 yaml - name: Read CHANGELOG.md and extract release notes id: read_changelog shell: bash run: | # 提取最新版本的变更内容 awk /^## \[/{if (c) exit; c1} c CHANGELOG.md release_notes.md # 处理特殊字符 r$(cat release_notes.md) r${r//%/%25} r${r//$\n/%0A} r${r//$\r/%0D} echo RELEASE_NOTES$r $GITHUB_OUTPUT3️⃣ 配置 upload-release-action实现文件上传与发布接下来我们需要配置 upload-release-action 步骤将构建产物和 CHANGELOG 内容上传到 Release- name: Upload release assets and notes uses: svenstaro/upload-release-actionv2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: target/release/* file_glob: true tag: ${{ github.ref }} overwrite: true body: ${{ steps.read_changelog.outputs.RELEASE_NOTES }} make_latest: true这个配置将使用 GitHub 提供的令牌进行身份验证上传target/release/目录下的所有文件覆盖已存在的同名资产将从 CHANGELOG.md 提取的内容作为 Release 描述将当前版本标记为最新版本 高级技巧优化你的 Release 流程使用矩阵构建支持多平台发布upload-release-action 支持在不同操作系统上运行结合 GitHub Actions 的矩阵功能可以轻松实现多平台构建和发布strategy: matrix: include: - os: ubuntu-latest artifact_path: target/release/myapp-linux - os: windows-latest artifact_path: target/release/myapp-windows.exe - os: macos-latest artifact_path: target/release/myapp-macos处理预发布和草稿通过设置prerelease和draft参数可以灵活控制发布状态with: prerelease: true # 标记为预发布 draft: false # 不设为草稿跨仓库发布如果需要将资产发布到其他仓库可以使用repo_name参数with: repo_name: owner/another-repo repo_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} 常见问题与解决方案权限问题如果遇到 resource not accessible by integration 错误需要添加适当的权限permissions: contents: write文件路径问题确保文件路径正确对于 glob 模式需要设置file_glob: truewith: file: dist/*.zip file_glob: true【免费下载链接】upload-release-actionUpload files to a GitHub release项目地址: https://gitcode.com/gh_mirrors/up/upload-release-action创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考