From 7402cb0afd5f4a93c88a1f8a60e0c280454bf952 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 20 Jun 2024 08:48:19 -0400 Subject: [PATCH 1/6] Commit Cargo files during release script --- scripts/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release.sh b/scripts/release.sh index fdb10245c..63200cbe7 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -53,7 +53,7 @@ fi echo "Committing version" towncrier build --version $VERSION -git commit CHANGELOG.md changelog.d/ package.json -m $TAG +git commit CHANGELOG.md changelog.d/ package.json Cargo.toml Cargo.lock -m $TAG echo "Proceeding to generate tags" git tag -F draft-release.txt -s $TAG From aca1d2d6c06ddfad67bd852036db49cac101d880 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 20 Jun 2024 08:48:50 -0400 Subject: [PATCH 2/6] Change "y/N" prompt appearance to match towncrier --- scripts/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release.sh b/scripts/release.sh index 63200cbe7..f72825f6f 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -44,7 +44,7 @@ echo "Drafting a new release" towncrier build --draft --version $VERSION> draft-release.txt cat draft-release.txt -read -p "Happy with the changelog? " prompt +read -p "Happy with the changelog? [y/N] " prompt if [[ $prompt != "y" && $prompt != "Y" && $prompt != "yes" && $prompt != "Yes" ]] then rm draft-release.txt From 774b3483d3c1f41ba11237413d504ee85aaad49f Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 20 Jun 2024 08:54:16 -0400 Subject: [PATCH 3/6] Prompt before releasing with unstaged changes --- scripts/release.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/release.sh b/scripts/release.sh index f72825f6f..0105fb0c6 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -40,6 +40,17 @@ if [ $(git tag -l "$TAG") ]; then exit 5 fi +GIT_STATUS=$(git status --porcelain) +if [[ -n $GIT_STATUS ]]; then + echo "Uncommitted changes:" + echo $GIT_STATUS + read -p "Continue anyways? [y/N] " prompt + if [[ $prompt != "y" && $prompt != "Y" && $prompt != "yes" && $prompt != "Yes" ]] + then + exit 0 + fi +fi + echo "Drafting a new release" towncrier build --draft --version $VERSION> draft-release.txt cat draft-release.txt From 9ce847440f0e32634d2d7cfa5f87e409678a4696 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 20 Jun 2024 09:10:22 -0400 Subject: [PATCH 4/6] Revert releaser script to check working tree because the release script commits the working tree contents of the metadata files, not just what has been staged --- scripts/release.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 0105fb0c6..582b98755 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -7,19 +7,19 @@ then exit 1 fi -VERSION=`jq -r .version <(git show :package.json)` +VERSION=`jq -r .version package.json` function parseCargoVersion { awk '$1 == "version" {gsub("\"", "", $3); print $3}' $1 } -CARGO_TOML_VERSION=`parseCargoVersion <(git show :Cargo.toml)` +CARGO_TOML_VERSION=`parseCargoVersion 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 <(git show :Cargo.lock))` +CARGO_LOCK_VERSION=`parseCargoVersion <(grep -A1 matrix-hookshot 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 @@ -40,7 +40,7 @@ if [ $(git tag -l "$TAG") ]; then exit 5 fi -GIT_STATUS=$(git status --porcelain) +GIT_STATUS=$(git status --porcelain | grep -vE 'package.json|Cargo.(lock|toml)') if [[ -n $GIT_STATUS ]]; then echo "Uncommitted changes:" echo $GIT_STATUS From 55b00745f0c002da8833df3c84b18014412a505e Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 20 Jun 2024 09:23:13 -0400 Subject: [PATCH 5/6] Add changelog --- changelog.d/misc.946 | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/misc.946 diff --git a/changelog.d/misc.946 b/changelog.d/misc.946 new file mode 100644 index 000000000..90c7599b6 --- /dev/null +++ b/changelog.d/misc.946 @@ -0,0 +1 @@ +Update the releaser script to commit changes to the Cargo metadata files and to warn about uncommitted changes. From dc236a6db102154ab80f20c50aabbed28329c433 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Thu, 20 Jun 2024 09:30:28 -0400 Subject: [PATCH 6/6] Rename changelog file --- changelog.d/{misc.946 => 946.misc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/{misc.946 => 946.misc} (100%) diff --git a/changelog.d/misc.946 b/changelog.d/946.misc similarity index 100% rename from changelog.d/misc.946 rename to changelog.d/946.misc