Skip to content

Commit

Permalink
Handle invalid draft option
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jun 23, 2021
1 parent 7bb073a commit 3bf72d0
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ version="${tag#v}"
title="${title/\$tag/${tag}}"
title="${title/\$version/${version}}"

case "${draft}" in
true)
draft_option="--draft"
;;
false) ;;
*)
error "'draft' input option must be 'true' or 'false': ${draft}"
exit 1
;;
esac

if [[ -n "${changelog}" ]]; then
case "${OSTYPE}" in
linux*)
Expand Down Expand Up @@ -64,11 +75,5 @@ if gh release view "${tag}" &>/dev/null; then
gh release delete "${tag}" -y
fi

gh_options=""

if [[ "$draft" == "true" ]]; then
gh_options="--draft"
fi

# https://cli.github.com/manual/gh_release_create
gh release create ${gh_options} "${tag}" ${prerelease:-} --title "${title}" --notes "${notes:-}"
gh release create ${draft_option:-} "${tag}" ${prerelease:-} --title "${title}" --notes "${notes:-}"

0 comments on commit 3bf72d0

Please sign in to comment.