Skip to content

Commit 1df5a85

Browse files
Copilotcsharpfritz
andcommitted
Improve error handling and logging for nbgv commands
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
1 parent d5bc9d1 commit 1df5a85

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

scripts/generate-release-notes.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,8 @@ git log "$MERGE_BASE"..HEAD --no-merges --pretty=format:"- %aN" | sort -u
6868
echo ""
6969
echo ""
7070
# Note: When using this in a GitHub release, replace {PREVIOUS_VERSION} with the actual previous version tag
71-
CURRENT_VERSION=$(nbgv get-version -v Version 2>/dev/null || echo "0.0")
71+
CURRENT_VERSION=$(nbgv get-version -v Version 2>/dev/null)
72+
if [ -z "$CURRENT_VERSION" ]; then
73+
CURRENT_VERSION="UNKNOWN_VERSION"
74+
fi
7275
echo "_Full Changelog_: https://github.com/FritzAndFriends/BlazorWebFormsComponents/compare/v{PREVIOUS_VERSION}...v${CURRENT_VERSION}"

scripts/publish-release.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ if ! git diff-index --quiet HEAD --; then
3333
fi
3434

3535
# Get the version from nbgv
36-
VERSION=$(nbgv get-version -v Version 2>/dev/null)
36+
VERSION=$(nbgv get-version -v Version 2>&1)
37+
if [ $? -ne 0 ]; then
38+
echo -e "${RED}Error: Could not read version using nbgv${NC}" >&2
39+
echo "nbgv output: $VERSION" >&2
40+
echo "Make sure you are in a git repository with version.json" >&2
41+
exit 1
42+
fi
43+
3744
if [ -z "$VERSION" ]; then
38-
echo -e "${RED}Error: Could not read version using nbgv${NC}"
39-
echo "Make sure you are in a git repository with version.json"
45+
echo -e "${RED}Error: nbgv returned an empty version${NC}" >&2
4046
exit 1
4147
fi
4248

0 commit comments

Comments
 (0)