Skip to content

Commit 0fb275b

Browse files
committed
Making the suggested improvements
1 parent 98c671f commit 0fb275b

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

package_release.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616

1717
set -e
1818

19+
CURRENT_DIR=$(pwd)
20+
SLN_FILE="${CURRENT_DIR}/FirebaseAdmin/FirebaseAdmin.sln"
21+
if [[ ! -f "${SLN_FILE}" ]]; then
22+
echo "[ERROR] Package script must be executed from the root of the project."
23+
exit 1
24+
fi
25+
1926
if [[ -z "${FrameworkPathOverride}" ]]; then
2027
echo "[INFO] FrameworkPathOverride not set. Using default."
2128
FrameworkPathOverride="/usr/lib/mono/4.5/"

prepare_release.sh

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ if [[ -z "$1" ]]; then
5252
exit 1
5353
fi
5454

55+
CURRENT_DIR=$(pwd)
56+
SLN_FILE="${CURRENT_DIR}/FirebaseAdmin/FirebaseAdmin.sln"
57+
if [[ ! -f "${SLN_FILE}" ]]; then
58+
echo "[ERROR] Prepare script must be executed from the root of the project."
59+
exit 1
60+
fi
5561

5662
#############################
5763
# VALIDATE VERSION NUMBER #
@@ -103,24 +109,22 @@ fi
103109
# Ensure the checked out branch is master
104110
CHECKED_OUT_BRANCH="$(git branch | grep "*" | awk -F ' ' '{print $2}')"
105111
if [[ $CHECKED_OUT_BRANCH != "master" ]]; then
106-
read -p "[WARN] You are on the '${CHECKED_OUT_BRANCH}' branch, not 'master'. Continue? (Y/n) " CONTINUE
107-
echo
108-
109-
if ! [[ $CONTINUE == "Y" ]]; then
110-
echo "[INFO] You chose not to continue."
111-
exit 1
112-
fi
112+
read -p "[WARN] You are on the '${CHECKED_OUT_BRANCH}' branch, not 'master'. Continue? (y/N) " CONTINUE
113+
case $CONTINUE in
114+
y|Y) ;;
115+
*) echo "[INFO] You chose not to continue." ;
116+
exit 1 ;;
117+
esac
113118
fi
114119

115120
# Ensure the branch does not have local changes
116121
if [[ $(git status --porcelain) ]]; then
117-
read -p "[WARN] Local changes exist in the repo. Continue? (Y/n) " CONTINUE
118-
echo
119-
120-
if ! [[ $CONTINUE == "Y" ]]; then
121-
echo "[INFO] You chose not to continue."
122-
exit 1
123-
fi
122+
read -p "[WARN] Local changes exist in the repo. Continue? (y/N) " CONTINUE
123+
case $CONTINUE in
124+
y|Y) ;;
125+
*) echo "[INFO] You chose not to continue." ;
126+
exit 1 ;;
127+
esac
124128
fi
125129

126130

@@ -131,10 +135,12 @@ fi
131135
HOST=$(uname)
132136
echo "[INFO] Updating FirebaseAdmin.csproj and CHANGELOG.md"
133137
sed -i -e "s/<Version>$CUR_VERSION<\/Version>/<Version>$VERSION<\/Version>/" "${PROJECT_FILE}"
134-
sed -i -e "1 s/# Unreleased//" "CHANGELOG.md"
135-
136138

137-
echo -e "# Unreleased\n\n-\n\n# v${VERSION}" | cat - CHANGELOG.md > TEMP_CHANGELOG.md
139+
awk '
140+
BEGIN { print "# Unreleased\n\n-\n\n# v'${VERSION}'" }
141+
/^# Unreleased$/ { next }
142+
{ print }
143+
' CHANGELOG.md > TEMP_CHANGELOG.md
138144
mv TEMP_CHANGELOG.md CHANGELOG.md
139145

140146

0 commit comments

Comments
 (0)