@@ -6,48 +6,48 @@ set -eu -o pipefail
66# before making any changes to the repository
77
88check_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
9+ if ! command -v " $1 " & > /dev/null; then
10+ echo " Error: $1 is not installed or not in PATH"
11+ exit 1
12+ fi
1313}
1414
1515# 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
16+ if ! gh auth status & > /dev/null; then
17+ echo " Error: gh CLI is not authenticated. Run 'gh auth login' first."
18+ exit 1
1919fi
2020
2121# 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
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
2525fi
2626
2727# 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
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
3131fi
3232
3333check_command dotnet
3434
3535# Check that we're not on the main branch
3636current_branch=$( git branch --show-current)
3737if [ " $current_branch " = " main" ]; then
38- echo " Error: Releases should not be done directly on the main branch."
39- echo " Please create a release branch and run this script from there."
40- exit 1
38+ echo " Error: Releases should not be done directly on the main branch."
39+ echo " Please create a release branch and run this script from there."
40+ exit 1
4141fi
4242
4343# Fetch latest changes and check that we're not behind origin/main
4444echo " Fetching from origin..."
4545git fetch origin
4646
4747if ! git merge-base --is-ancestor origin/main HEAD; then
48- echo " Error: Current branch is behind origin/main."
49- echo " Please merge or rebase with origin/main before releasing."
50- exit 1
48+ echo " Error: Current branch is behind origin/main."
49+ echo " Please merge or rebase with origin/main before releasing."
50+ exit 1
5151fi
5252
5353changelog=$( cat releasenotes.md)
@@ -60,24 +60,24 @@ regex='
6060'
6161
6262if [[ ! $changelog =~ $regex ]]; then
63- echo " Could not find version/date in releasenotes.md!"
64- exit 1
63+ echo " Could not find version/date in releasenotes.md!"
64+ exit 1
6565fi
6666
6767version=" ${BASH_REMATCH[1]} "
6868date=" ${BASH_REMATCH[3]} "
6969notes=" $( echo " ${BASH_REMATCH[4]} " | sed -n -e ' /^## [0-9]\+\.[0-9]\+\.[0-9]\+/,$!p' ) "
7070
7171if [[ " $date " != " $( date +" %Y-%m-%d" ) " ]]; then
72- echo " $date is not today!"
73- exit 1
72+ echo " $date is not today!"
73+ exit 1
7474fi
7575
7676tag=" v$version "
7777
7878if [ -n " $( git status --porcelain) " ]; then
79- echo " . is not clean." >&2
80- exit 1
79+ echo " . is not clean." >&2
80+ exit 1
8181fi
8282
8383# Update version in csproj
@@ -93,11 +93,11 @@ git diff
9393echo $' \n Release notes:'
9494echo " $notes "
9595
96- 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
9797
9898if [ " $should_continue " != " y" ]; then
99- echo " Aborting"
100- exit 1
99+ echo " Aborting"
100+ exit 1
101101fi
102102
103103git commit -m " Prepare for $version " -a
0 commit comments