fix(ci): replace sed version bump with npm version to prevent script corruption#125
Open
Kyzgor wants to merge 1 commit into
Open
fix(ci): replace sed version bump with npm version to prevent script corruption#125Kyzgor wants to merge 1 commit into
Kyzgor wants to merge 1 commit into
Conversation
…corruption The CI workflow used `sed -i "s/\"version\": \".*\"/.../"` to bump the version in package.json before publishing. This greedy regex matched every `"version": "..."` pattern in the file, including the `version` script in the `scripts` block, corrupting it from `"standard-version"` to the release version string. Replace sed with `npm version --no-git-tag-version --allow-same-version` which safely modifies only the top-level `version` field. Also restore the corrupted `version` script to its original value. Fixes permitio#89
fb9c66a to
a14220b
Compare
Author
|
The |
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.
What kind of change does this PR introduce?
Bug fix (CI / release tooling).
What is the current behavior? (link: CI workflow uses a regexp replace and changed the
versionscript #89)The publish workflow (
.github/workflows/node_sdk_publish.yaml) bumps the package version beforepublishing with a greedy
sed:This regex matches every
"version":key inpackage.json, not just the top-level field. Thescriptsblock contains"version": "standard-version"(astandard-versionlifecycle hookinvoked by
prepare-release:run-s reset-hard test cov:check doc:html version doc:publish). Thesedrun overwrites that script with the release version string. The corruption already happened(introduced in commit
2abe31f) and is still live onmaintoday —scripts.versionis"2.5.2"instead of"standard-version", so theversionstep ofprepare-releaseis broken.What is the new behavior (if this is a feature change)?
The bump step uses npm's JSON-aware tooling, which only mutates the top-level
versionfield:--no-git-tag-version— no commit/tag created in CI.--ignore-scripts— does not fire theversionlifecycle script (standard-version) during the bump.--allow-same-version— tolerates re-runs / a tag equal to the current version.package.json'sscripts.versionis also restored from the corrupted"2.5.2"back to"standard-version". This matches the fix suggested in CI workflow uses a regexp replace and changed theversionscript #89.Other information:
Reproduced before/after (same input package.json, tag
9.9.9)What's NOT in this PR: no broader rewrite of the publish workflow, no
standard-versionautomated-release wiring, no dependency changes, no source changes. (A separate, unrelated issue:
prepare-releasealso referencesdoc:html/doc:publishscripts that aren't defined — out ofscope here.)
The
security/snyk (permit)check shows ERROR; this is an external/integration issue on fork PRs(this PR adds no dependencies and changes only CI config + a script string). A maintainer re-run or
waiver would clear it.
Fixes CI workflow uses a regexp replace and changed the
versionscript #89