From 7e3be4e1f3887471d358a72a4aacb0a844075dc0 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Wed, 22 Nov 2023 10:01:15 -0500 Subject: [PATCH] Update releaser script to check staged contents (#846) to ensure that the package versions to be committed are correct. --- changelog.d/846.misc | 1 + scripts/release.sh | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 changelog.d/846.misc diff --git a/changelog.d/846.misc b/changelog.d/846.misc new file mode 100644 index 00000000..8a23cf3c --- /dev/null +++ b/changelog.d/846.misc @@ -0,0 +1 @@ +Update the release script to examine the staged contents of package files when checking for consistency between Node & Rust package versions. diff --git a/scripts/release.sh b/scripts/release.sh index c88984fd..fdb10245 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -7,19 +7,19 @@ then exit 1 fi -VERSION=`jq -r .version package.json` +VERSION=`jq -r .version <(git show :package.json)` function parseCargoVersion { awk '$1 == "version" {gsub("\"", "", $3); print $3}' $1 } -CARGO_TOML_VERSION=`parseCargoVersion Cargo.toml` +CARGO_TOML_VERSION=`parseCargoVersion <(git show :Cargo.toml)` if [[ $VERSION != $CARGO_TOML_VERSION ]]; then echo "Node & Rust package versions do not match." >&2 echo "Node version (package.json): ${VERSION}" >&2 echo "Rust version (Cargo.toml): ${CARGO_TOML_VERSION}" >&2 exit 2 fi -CARGO_LOCK_VERSION=`parseCargoVersion <(grep -A1 matrix-hookshot Cargo.lock)` +CARGO_LOCK_VERSION=`parseCargoVersion <(grep -A1 matrix-hookshot <(git show :Cargo.lock))` if [[ $CARGO_TOML_VERSION != $CARGO_LOCK_VERSION ]]; then echo "Rust package version does not match the lockfile." >&2 echo "Rust version (Cargo.toml): ${CARGO_TOML_VERSION}" >&2