Skip to content

Commit 35b1cc8

Browse files
committed
terminate script when a command fails
- Previously, when the git push command failed, the script would still echo a success message. - This commit also makes sure the git describe command does not terminate the script.
1 parent be270a6 commit 35b1cc8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

script/release

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
# Exit early
4+
# See: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#The-Set-Builtin
5+
set -e
6+
37
# About:
48
#
59
# This is a helper script to tag and push a new release. GitHub Actions use
@@ -29,9 +33,7 @@ GREEN='\033[0;32m'
2933
BLUE='\033[0;34m'
3034

3135
# Get the latest release tag
32-
latest_tag=$(git describe --abbrev=0 --match="$tag_glob")
33-
34-
if [[ -z "$latest_tag" ]]; then
36+
if ! latest_tag=$(git describe --abbrev=0 --match="$tag_glob"); then
3537
# There are no existing release tags
3638
echo -e "No tags found (yet) - Continue to create and push your first tag"
3739
latest_tag="[unknown]"

0 commit comments

Comments
 (0)