Update releaser script to check staged contents (#846)

to ensure that the package versions to be committed are correct.
This commit is contained in:
Andrew Ferrazzutti 2023-11-22 10:01:15 -05:00 committed by GitHub
parent e808002ad7
commit 7e3be4e1f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

1
changelog.d/846.misc Normal file
View File

@ -0,0 +1 @@
Update the release script to examine the staged contents of package files when checking for consistency between Node & Rust package versions.

View File

@ -7,19 +7,19 @@ then
exit 1 exit 1
fi fi
VERSION=`jq -r .version package.json` VERSION=`jq -r .version <(git show :package.json)`
function parseCargoVersion { function parseCargoVersion {
awk '$1 == "version" {gsub("\"", "", $3); print $3}' $1 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 if [[ $VERSION != $CARGO_TOML_VERSION ]]; then
echo "Node & Rust package versions do not match." >&2 echo "Node & Rust package versions do not match." >&2
echo "Node version (package.json): ${VERSION}" >&2 echo "Node version (package.json): ${VERSION}" >&2
echo "Rust version (Cargo.toml): ${CARGO_TOML_VERSION}" >&2 echo "Rust version (Cargo.toml): ${CARGO_TOML_VERSION}" >&2
exit 2 exit 2
fi 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 if [[ $CARGO_TOML_VERSION != $CARGO_LOCK_VERSION ]]; then
echo "Rust package version does not match the lockfile." >&2 echo "Rust package version does not match the lockfile." >&2
echo "Rust version (Cargo.toml): ${CARGO_TOML_VERSION}" >&2 echo "Rust version (Cargo.toml): ${CARGO_TOML_VERSION}" >&2