diff --git a/scripts/release.sh b/scripts/release.sh index a71d49218..871496f21 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -140,6 +140,29 @@ update_readme_version_row() { ' "$file" "$VERSION" "$label" "$first_col" "$second_col" "$third_col" } +update_marketplace_plugin_version() { + local file="$1" + # Was `sed "0,/re/s|..."`, which is a GNU extension. BSD sed on macOS ignores + # it and still exits 0, so the bump silently no-opped here and only surfaced + # later as a plugin-manifest test failure. Node replaces the first match on + # every platform and fails loudly. + node -e ' + const fs = require("fs"); + const file = process.argv[1]; + const version = process.argv[2]; + const current = fs.readFileSync(file, "utf8"); + const updated = current.replace( + /"version": *"[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?"/, + `"version": "${version}"` + ); + if (updated === current) { + console.error(`Error: could not update plugin version in ${file}`); + process.exit(1); + } + fs.writeFileSync(file, updated); + ' "$file" "$VERSION" +} + update_latest_release_heading() { local file="$1" node -e ' @@ -268,7 +291,7 @@ update_agents_version "$ZH_CN_AGENTS_MD" "版本" update_agent_yaml_version update_version_file update_version "$PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|" -update_version "$MARKETPLACE_JSON" "0,/\"version\": *\"[^\"]*\"/s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|" +update_marketplace_plugin_version "$MARKETPLACE_JSON" update_codex_marketplace_version update_version "$CODEX_PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|" update_version "$CODEX_MARKETPLACE_PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|" @@ -281,6 +304,9 @@ update_latest_release_heading "$README_FILE" update_latest_release_heading "$ROOT_ZH_CN_README_FILE" update_latest_release_heading "$TR_README_FILE" update_latest_release_heading "$PT_BR_README_FILE" +# docs/zh-CN/README.md got its version row bumped but never its release +# heading, so plugin-manifest.test.js failed on it every time. +update_latest_release_heading "$ZH_CN_README_FILE" update_selective_install_repo_version "$SELECTIVE_INSTALL_ARCHITECTURE_DOC" # Verify the bumped release surface is still internally consistent before