A deploy script that failed silently in the middle is a script nobody can debug from the logs, and the fix is one line rather than a rewrite with echo statements.
#!/usr/bin/env bash
set -euo pipefail
# everything, with variables expanded, to stderr
[ "${DEBUG:-0}" = "1" ] && set -x
# and a prompt that says where you are
export PS4='+ ${BASH_SOURCE##*/}:${LINENO}: '
The PS4 setting is what turns the trace from a wall of commands into something with file and line numbers, and almost nobody sets it. Guarding on an environment variable means the trace is available in CI by rerunning with DEBUG=1 rather than by editing the script. Note that set -x prints expanded variables, so a script handling secrets needs set +x around those lines or the token ends up in the build log.