Skip to content

Commit c46ca29

Browse files
authored
Merge pull request #247 from maxmind/greg/eng-1733
Improve release script reliability (ENG-1733)
2 parents be73892 + 9d95d54 commit c46ca29

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

dev-bin/release.sh

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22

33
set -eu -o pipefail
44

5+
# Pre-flight checks - verify all required tools are available and configured
6+
# before making any changes to the repository
7+
8+
check_command() {
9+
if ! command -v "$1" &>/dev/null; then
10+
echo "Error: $1 is not installed or not in PATH"
11+
exit 1
12+
fi
13+
}
14+
15+
# Verify gh CLI is authenticated
16+
if ! gh auth status &>/dev/null; then
17+
echo "Error: gh CLI is not authenticated. Run 'gh auth login' first."
18+
exit 1
19+
fi
20+
21+
# Verify we can access this repository via gh
22+
if ! gh repo view --json name &>/dev/null; then
23+
echo "Error: Cannot access repository via gh. Check your authentication and repository access."
24+
exit 1
25+
fi
26+
27+
# Verify git can connect to the remote (catches SSH key issues, etc.)
28+
if ! git ls-remote origin &>/dev/null; then
29+
echo "Error: Cannot connect to git remote. Check your git credentials/SSH keys."
30+
exit 1
31+
fi
32+
33+
check_command dotnet
34+
535
# Check that we're not on the main branch
636
current_branch=$(git branch --show-current)
737
if [ "$current_branch" = "main" ]; then
@@ -63,7 +93,7 @@ git diff
6393
echo $'\nRelease notes:'
6494
echo "$notes"
6595

66-
read -e -p "Commit changes and create release? (y/n) " should_continue
96+
read -r -e -p "Commit changes and create release? (y/n) " should_continue
6797

6898
if [ "$should_continue" != "y" ]; then
6999
echo "Aborting"

0 commit comments

Comments
 (0)