Skip to content

Commit 827a6f2

Browse files
data-douserCopilot
andauthored
Update server/scripts/update-release-version.sh
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Nathan Randall <70299490+data-douser@users.noreply.github.com>
1 parent 6941744 commit 827a6f2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/scripts/update-release-version.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,17 @@ update_pack_version() {
278278
update_ts_version() {
279279
local file="$1"
280280
local new_version="$2"
281+
local matches
282+
283+
## Ensure there is exactly one VERSION constant to update
284+
matches=$(grep -c "const VERSION = '" "${file}" || true)
285+
if [[ "${matches}" -eq 0 ]]; then
286+
echo "Error: Could not find a 'const VERSION = ...' definition in ${file}" >&2
287+
exit 1
288+
elif [[ "${matches}" -gt 1 ]]; then
289+
echo "Error: Found multiple 'const VERSION = ...' definitions in ${file}" >&2
290+
exit 1
291+
fi
281292
sed -i.bak "s/const VERSION = '[^']*'/const VERSION = '${new_version}'/" "${file}"
282293
rm -f "${file}.bak"
283294
}

0 commit comments

Comments
 (0)