Repository navigation
Stage automatic v0.2.6 release #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Prepare automatic v0.2.6 release | ||
| on: | ||
| push: | ||
| branches: | ||
| - agent/fix-open-issue-root-causes | ||
| paths: | ||
| - .github/workflows/agent-prepare-v0.2.6.yml | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| prepare-release: | ||
| if: github.actor != 'github-actions[bot]' | ||
| runs-on: windows-2025-vs2026 | ||
| timeout-minutes: 10 | ||
| defaults: | ||
| run: | ||
| shell: pwsh | ||
| steps: | ||
| - name: Checkout branch | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Bump package version and document automatic release | ||
| run: | | ||
| function Replace-ExactlyOnce { | ||
| param( | ||
| [Parameter(Mandatory)][string]$Path, | ||
| [Parameter(Mandatory)][string]$Old, | ||
| [Parameter(Mandatory)][string]$New | ||
| ) | ||
| $text = Get-Content -LiteralPath $Path -Raw | ||
| $count = ([regex]::Matches($text, [regex]::Escape($Old))).Count | ||
| if ($count -ne 1) { | ||
| throw "$Path expected exactly one match, found $count" | ||
| } | ||
| $updated = $text.Replace($Old, $New) | ||
| [IO.File]::WriteAllText((Resolve-Path -LiteralPath $Path).Path, $updated, [Text.UTF8Encoding]::new($false)) | ||
| } | ||
| Replace-ExactlyOnce ` | ||
| -Path 'Cargo.toml' ` | ||
| -Old 'version = "0.2.5"' ` | ||
| -New 'version = "0.2.6"' | ||
| Replace-ExactlyOnce ` | ||
| -Path 'Cargo.lock' ` | ||
| -Old "name = `"taskmgr-rs`"`nversion = `"0.2.5`"" ` | ||
| -New "name = `"taskmgr-rs`"`nversion = `"0.2.6`"" | ||
| $oldEnglish = @' | ||
| To publish a version, first update `Cargo.toml` and `Cargo.lock`, merge the change, then push the | ||
| matching tag such as `v0.2.5`. The Release workflow rejects a tag that does not exactly match the | ||
| Cargo package version. It builds all three architectures in parallel, verifies the PE machine and | ||
| '@ | ||
| $newEnglish = @' | ||
| To publish a version, update `Cargo.toml` and `Cargo.lock` together and merge the change to `main`. | ||
| The Release workflow reads the package version and automatically creates the matching tag (for | ||
| example `v0.2.6`) when it does not exist. It builds all three architectures in parallel, verifies the PE machine and | ||
| '@ | ||
| Replace-ExactlyOnce -Path 'README.md' -Old $oldEnglish.TrimEnd("`r", "`n") -New $newEnglish.TrimEnd("`r", "`n") | ||
| $oldChinese = @' | ||
| 发布版本时,先同步修改 `Cargo.toml` 与 `Cargo.lock` 并合入主线,再推送与版本完全一致的 tag, | ||
| 例如 `v0.2.5`。Release 工作流会拒绝与 Cargo 包版本不一致的 tag,并行构建三种架构,核对 PE | ||
| '@ | ||
| $newChinese = @' | ||
| 发布版本时,只需同步修改 `Cargo.toml` 与 `Cargo.lock` 并合入 `main`。Release 工作流会读取包 | ||
| 版本;如果对应 tag(例如 `v0.2.6`)尚不存在,就自动创建 tag,并行构建三种架构,核对 PE | ||
| '@ | ||
| Replace-ExactlyOnce -Path 'README.zh-CN.md' -Old $oldChinese.TrimEnd("`r", "`n") -New $newChinese.TrimEnd("`r", "`n") | ||
| Remove-Item -LiteralPath '.github/workflows/agent-prepare-v0.2.6.yml' | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git add Cargo.toml Cargo.lock README.md README.zh-CN.md .github/workflows/agent-prepare-v0.2.6.yml | ||
| git diff --cached --check | ||
| git diff --cached --exit-code --quiet && throw 'release preparation produced no changes' | ||
| git commit -m "Prepare v0.2.6 automatic release" | ||
| git push origin "HEAD:$env:GITHUB_REF_NAME" | ||