Skip to content

fix(ci): scope version-bump regex to [package] section, inline wv2-windows-core#231

Merged
YCC3741 merged 2 commits intocodefrom
fix/ci-version-bump-regex
Apr 20, 2026
Merged

fix(ci): scope version-bump regex to [package] section, inline wv2-windows-core#231
YCC3741 merged 2 commits intocodefrom
fix/ci-version-bump-regex

Conversation

@YCC3741
Copy link
Copy Markdown
Collaborator

@YCC3741 YCC3741 commented Apr 20, 2026

Summary

Fixes the broken release workflow that has been failing since #230 was merged. See run #20 / job 72225904016.

Root cause

.github/workflows/build-and-release.yml bumps the package version with this regex:

$cargo = $cargo -replace '(?m)^version\s*=\s*"[\d.]+"', "version = `"$semVer`""

(?m)^version matches every line starting with version, including the standalone version = "0.61" line inside the [target.'cfg(windows)'.dependencies.wv2-windows-core] section that was added in #230. The workflow rewrote that line to the new package version (e.g. 5.9.3), so cargo then tried to resolve windows-core = "^5.9.3", which does not exist on crates.io (latest is 0.62.x):

error: failed to select a version for the requirement `windows-core = "^5.9.3"`
candidate versions found which didn't match: 0.62.2, 0.62.1, 0.62.0, ...

Changes

  1. fix(ci) — scope version-bump regex to [package] section only. New pattern anchors on [package] and stops at the next section header via a (?!\r?\n\[) negative lookahead (CRLF/LF safe). Locally verified against the actual Cargo.toml: [package] version replaced as expected, wv2-windows-core version untouched.
  2. refactor(deps) — inline wv2-windows-core declaration. Defensive change so future contributors don't have to rely on the regex being perfectly scoped. Semantically identical, Cargo.lock unchanged.

The two changes are independent — either one alone fixes the build — but together they remove both the bug and the foot-gun.

Out of scope

The Node.js 20 actions are deprecated warning shown on the same run is not addressed here. Dependabot has previously opened #219 / #220 / #221 for these bumps and they were closed by maintainers; want to discuss separately before reopening.

Test plan

  • Trigger Build and Release workflow (workflow_dispatch) on this branch and confirm the build step succeeds.
  • Verify the bumped Cargo.toml only changes the [package] version line (workflow log "Update version in Cargo.toml..." step).

YCC3741 added 2 commits April 21, 2026 07:26
The previous `(?m)^version\s*=\s*"[\d.]+"` pattern in the version-bump
step matched every line starting with `version`, including the
`version = "0.61"` inside `[target.'cfg(windows)'.dependencies.wv2-windows-core]`
introduced by #230. The release workflow rewrote that line to the package
version, causing cargo to look up `windows-core = "^5.9.3"` and fail with
`failed to select a version for the requirement` (see run #20 / job
72225904016).

Scope the replacement to the [package] section only by anchoring on
`[package]` and stopping at the next section header via a `(?!\r?\n\[)`
negative lookahead. CRLF/LF endings are both handled.
The release workflow rewrites the package `version` line in Cargo.toml
on every build. Declaring `wv2-windows-core` via the explicit-table form
`[target.'cfg(windows)'.dependencies.wv2-windows-core]` produced a
standalone `version = "0.61"` line that the workflow's regex used to
mistakenly target (see the previous commit fix(ci): scope version-bump
regex to [package] section only).

Switch to the inline form `wv2-windows-core = { package = "windows-core",
version = "0.61" }` so future contributors do not have to rely on the
regex being perfectly scoped. Semantically identical -- same package
alias, same version, same target predicate; Cargo.lock is unchanged.
@YCC3741 YCC3741 merged commit 23e5c9a into code Apr 20, 2026
2 checks passed
@YCC3741 YCC3741 deleted the fix/ci-version-bump-regex branch April 21, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant