Skip to content

Commit e3f6060

Browse files
committed
make_release
1 parent cdb6ecb commit e3f6060

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

scripts/sh/make_release.sh

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -Eeuo pipefail
88
# 🔧 CONFIG
99
#######################################
1010
SCRIPT_NAME="$(basename "$0")"
11-
SCRIPT_VERSION="2.6.1"
11+
SCRIPT_VERSION="2.6.2"
1212
SCRIPT_AUTHOR="Federico Girolami"
1313
SCRIPT_TEAM="Pytorchia™ Developers"
1414
SCRIPT_LICENSE="MIT License"
@@ -98,18 +98,20 @@ die() {
9898
exit 1
9999
}
100100

101+
# ESEGUE i comandi preservando gli argomenti (no eval), stampa solo se DEBUG
101102
run() {
102-
# esegue i comandi preservando gli argomenti (niente eval)
103103
local -a cmd=("$@")
104104
if [[ "$DRY_RUN" == true ]]; then
105105
warn "DRY-RUN → ${cmd[*]}"
106-
else
107-
#dbg "exec → ${cmd[*]}"
108-
"${cmd[@]}"
106+
return 0
109107
fi
108+
[[ "$DEBUG" == true ]] && printf '%s[dbg]%s %s\n' "$MAGENTA" "$RESET" "exec → ${cmd[*]}"
109+
"${cmd[@]}"
110110
}
111111

112-
trap 'err "Errore a riga $LINENO . Uscita ." ' ERR
112+
# Trap più utile (mostra comando e exit code)
113+
set -o errtrace
114+
trap 'err "Cmd: ${BASH_COMMAND} → exit $? (line ${BASH_LINENO[0]})" ' ERR
113115

114116
#######################################
115117
# 🧱 Banner
@@ -514,13 +516,15 @@ auto_chain_if_needed() {
514516
# Tests
515517
if [[ "$RUN_TESTS" == true ]]; then
516518
info "Eseguo test : npm run $TEST_SCRIPT"
517-
run bash -lc "cd \"$REPO_ROOT_DIR\" && npm run \"$TEST_SCRIPT\""
519+
run bash -lc "cd \"$REPO_ROOT_DIR\" && npm run \"$TEST_SCRIPT\"" \
520+
|| die "Test falliti (script: $TEST_SCRIPT)"
518521
fi
519522

520523
# Build
521524
if [[ "$RUN_BUILD" == true ]]; then
522525
info "Eseguo build : npm run $BUILD_SCRIPT"
523-
run bash -lc "cd \"$REPO_ROOT_DIR\" && npm run \"$BUILD_SCRIPT\""
526+
run bash -lc "cd \"$REPO_ROOT_DIR\" && npm run \"$BUILD_SCRIPT\"" \
527+
|| die "Build fallita (script: $BUILD_SCRIPT)"
524528
fi
525529

526530
# Bump
@@ -588,14 +592,14 @@ do_release() {
588592
# Tag GH: se npm version ha già creato il tag, lo vedremo esistente
589593
ensure_tag
590594

591-
# Assets (compat bash 3.2; niente mapfile, niente echo; safe con spazi)
595+
# Assets (compat bash 3.2; niente mapfile/echo; safe con spazi; no trap su zero match)
592596
local -a assets_arg=()
593597
if [[ -n "$ASSETS_GLOB" ]]; then
594-
# compgen -G espande il glob in maniera robusta (0..N righe, una per match)
595598
local -a matches=()
599+
# Se non ci sono match, forziamo exit 0 nel subshell per non far scattare set -e
596600
while IFS= read -r line; do
597601
matches+=("$line")
598-
done < <(compgen -G -- "$ASSETS_GLOB")
602+
done < <(compgen -G -- "$ASSETS_GLOB" || true)
599603

600604
if ((${#matches[@]})); then
601605
for f in "${matches[@]}"; do

0 commit comments

Comments
 (0)