From e9f7e2cd0005f8d8a7caa3acf9cfc70ac5d03e51 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 3 Dec 2025 10:01:24 -0800 Subject: [PATCH 1/3] Add pre-flight checks to release script --- dev-bin/release.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dev-bin/release.sh b/dev-bin/release.sh index 47d2f91..3792ec1 100755 --- a/dev-bin/release.sh +++ b/dev-bin/release.sh @@ -2,6 +2,37 @@ set -eu -o pipefail +# Pre-flight checks - verify all required tools are available and configured +# before making any changes to the repository + +check_command() { + if ! command -v "$1" &> /dev/null; then + echo "Error: $1 is not installed or not in PATH" + exit 1 + fi +} + +# Verify gh CLI is authenticated +if ! gh auth status &> /dev/null; then + echo "Error: gh CLI is not authenticated. Run 'gh auth login' first." + exit 1 +fi + +# Verify we can access this repository via gh +if ! gh repo view --json name &> /dev/null; then + echo "Error: Cannot access repository via gh. Check your authentication and repository access." + exit 1 +fi + +# Verify git can connect to the remote (catches SSH key issues, etc.) +if ! git ls-remote origin &> /dev/null; then + echo "Error: Cannot connect to git remote. Check your git credentials/SSH keys." + exit 1 +fi + +check_command perl +check_command uv + # Check that we're not on the main branch current_branch=$(git branch --show-current) if [ "$current_branch" = "main" ]; then From 8807584f2ddce621b91950904cc1cb24b5565e01 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 3 Dec 2025 10:01:41 -0800 Subject: [PATCH 2/3] Standardize pre-release version support in release script --- dev-bin/release.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dev-bin/release.sh b/dev-bin/release.sh index 3792ec1..000096c 100755 --- a/dev-bin/release.sh +++ b/dev-bin/release.sh @@ -54,7 +54,7 @@ fi changelog=$(cat HISTORY.rst) regex=' -([0-9]+\.[0-9]+\.[0-9]+[a-z0-9]*) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\) +([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\) \+* ((.| @@ -67,8 +67,8 @@ if [[ ! $changelog =~ $regex ]]; then fi version="${BASH_REMATCH[1]}" -date="${BASH_REMATCH[2]}" -notes="$(echo "${BASH_REMATCH[3]}" | sed -n -E '/^[0-9]+\.[0-9]+\.[0-9]+/,$!p')" +date="${BASH_REMATCH[3]}" +notes="$(echo "${BASH_REMATCH[4]}" | sed -n -E '/^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?/,$!p')" if [[ "$date" != "$(date +"%Y-%m-%d")" ]]; then echo "$date is not today!" From d782d669cbca75e9d50775465b6e06b705bbb291 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 3 Dec 2025 13:25:52 -0800 Subject: [PATCH 3/3] Fix release script consistency issues - Remove redundant git push --tags (gh release create handles tags) - Fix shellcheck SC2162: add -r flag to read command - Apply shfmt formatting --- dev-bin/release.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/dev-bin/release.sh b/dev-bin/release.sh index 000096c..0887c3b 100755 --- a/dev-bin/release.sh +++ b/dev-bin/release.sh @@ -6,26 +6,26 @@ set -eu -o pipefail # before making any changes to the repository check_command() { - if ! command -v "$1" &> /dev/null; then + if ! command -v "$1" &>/dev/null; then echo "Error: $1 is not installed or not in PATH" exit 1 fi } # Verify gh CLI is authenticated -if ! gh auth status &> /dev/null; then +if ! gh auth status &>/dev/null; then echo "Error: gh CLI is not authenticated. Run 'gh auth login' first." exit 1 fi # Verify we can access this repository via gh -if ! gh repo view --json name &> /dev/null; then +if ! gh repo view --json name &>/dev/null; then echo "Error: Cannot access repository via gh. Check your authentication and repository access." exit 1 fi # Verify git can connect to the remote (catches SSH key issues, etc.) -if ! git ls-remote origin &> /dev/null; then +if ! git ls-remote origin &>/dev/null; then echo "Error: Cannot connect to git remote. Check your git credentials/SSH keys." exit 1 fi @@ -62,8 +62,8 @@ regex=' ' if [[ ! $changelog =~ $regex ]]; then - echo "Could not find date line in change log!" - exit 1 + echo "Could not find date line in change log!" + exit 1 fi version="${BASH_REMATCH[1]}" @@ -93,7 +93,7 @@ git diff echo $'\nRelease notes:' echo "$notes" -read -e -p "Commit changes and push to origin? " should_push +read -r -e -p "Commit changes and push to origin? " should_push if [ "$should_push" != "y" ]; then echo "Aborting" @@ -105,5 +105,3 @@ git commit -m "Update for $tag" -a git push gh release create --target "$(git branch --show-current)" -t "$version" -n "$notes" "$tag" - -git push --tags