Skip to content

Fix release action: update_version.sh corrupts dependency versions on release - #12

Merged
insane66613 merged 2 commits into
mainfrom
copilot/fix-release-action
Mar 12, 2026
Merged

Fix release action: update_version.sh corrupts dependency versions on release#12
insane66613 merged 2 commits into
mainfrom
copilot/fix-release-action

Conversation

Copilot AI commented Mar 12, 2026

Copy link
Copy Markdown

update_version.sh performed a blind global string replacement of the package's own version value across the entire package.json, inadvertently corrupting dependency version strings where the version appeared as a substring.

Example of the bug (releasing v0.6.4 with pages/content at version 0.4.2):

  • "autoprefixer": "^10.4.20""autoprefixer": "^10.6.40" (non-existent version)
  • Caused pnpm install --no-frozen-lockfile to fail with ERR_PNPM_NO_MATCHING_VERSION

Priority*

  • High: This PR needs to be merged first, before other tasks.
  • Medium: This PR should be merged quickly to prevent conflicts due to common changes. (default)
  • Low: This PR does not affect other tasks, so it can be merged later.

Purpose of the PR*

Fix the release GitHub Action, which was failing due to update_version.sh corrupting dependency version specifiers in package.json files during the version-bump step.

Changes*

  • bash-scripts/update_version.sh: Replace the naive full-file string substitution with a targeted regex anchored to the "version" JSON key only.
# Before — replaces ALL occurrences of the current version string in the file
perl -i -pe"s/$current_version/'$1'/" "$0"

# After — only replaces the value of the "version" key
perl -i -pe "s/(\"version\"\\s*:\\s*\")[^\"]*/\${1}$1/" {} \;

The new pattern captures "version": " as group 1 and replaces only the bare version value, leaving dependency version specifiers untouched regardless of substring overlap.

How to check the feature

Trigger the release workflow (via workflow_dispatch) with a tag where the package version (e.g., 0.4.2) is a substring of any dependency version string (e.g., ^10.4.20). The install step should complete without ERR_PNPM_NO_MATCHING_VERSION.

Reference

  • Failing run: the v0.6.4 release dispatch corrupted autoprefixer@^10.4.20^10.6.40 in pages/content/package.json because 0.4.210.4.20.

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…rrences

Co-authored-by: insane66613 <8126035+insane66613@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix the release action Fix release action: update_version.sh corrupts dependency versions on release Mar 12, 2026
Copilot AI requested a review from insane66613 March 12, 2026 23:52
@insane66613
insane66613 marked this pull request as ready for review March 12, 2026 23:53
@insane66613
insane66613 merged commit 8520ae8 into main Mar 12, 2026
1 check passed
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.

2 participants