fix(ci): scope version-bump regex to [package] section, inline wv2-windows-core#231
Merged
fix(ci): scope version-bump regex to [package] section, inline wv2-windows-core#231
Conversation
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.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ymlbumps the package version with this regex:(?m)^versionmatches every line starting withversion, including the standaloneversion = "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 resolvewindows-core = "^5.9.3", which does not exist on crates.io (latest is0.62.x):Changes
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 actualCargo.toml:[package]version replaced as expected,wv2-windows-coreversion untouched.refactor(deps)— inlinewv2-windows-coredeclaration. Defensive change so future contributors don't have to rely on the regex being perfectly scoped. Semantically identical,Cargo.lockunchanged.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 deprecatedwarning 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
Build and Releaseworkflow (workflow_dispatch) on this branch and confirm the build step succeeds.Cargo.tomlonly changes the[package]versionline (workflow log "Update version in Cargo.toml..." step).