diff --git a/ci/gen.sh b/ci/gen.sh index 02b1bd3c..44a3c2c1 100755 --- a/ci/gen.sh +++ b/ci/gen.sh @@ -6,6 +6,15 @@ cd "$(dirname "$0")"/.. # shellcheck disable=SC2154 trap 's=$?; echo >&2 "$0: Error on line "${LINENO}": ${BASH_COMMAND}"; exit ${s}' ERR +bail() { + echo >&2 "error: $*" + exit 1 +} + +if [[ -z "${CI:-}" ]]; then + bail "this script is intended to call from release workflow on CI" +fi + git config user.name "Taiki Endo" git config user.email "te316e89@gmail.com" diff --git a/tools/publish.sh b/tools/publish.sh index e9437e0f..b1a6c482 100755 --- a/tools/publish.sh +++ b/tools/publish.sh @@ -59,6 +59,7 @@ if gh release view "${tag}" &>/dev/null; then bail "tag '${tag}' has already been created and pushed" fi +# Make sure that the release was created from an allowed branch. if ! git branch | grep -q '\* main$'; then bail "current branch is not 'main'" fi