diff --git a/run.sh b/run.sh index 3cc69da..100c3e1 100755 --- a/run.sh +++ b/run.sh @@ -26,10 +26,23 @@ # can reference them (e.g. {{ get_env(name="PACKAGE_NAME") }}). set -euo pipefail -source "$(dirname "$0")/lib/utils.sh" -source "$(dirname "$0")/lib/logging.sh" +# Minimal utility functions for bootstrap +log_info() { + echo "[INFO] $1" +} -source "$(dirname "$0")/config.env" +log_error() { + echo "[ERROR] $1" >&2 +} + +validate_arg() { + local arg_name="$1" + local arg_value="$2" + if [[ -z "$arg_value" ]]; then + log_error "Missing required argument: $arg_name" + exit 1 + fi +} # ─────────────────────────────────────────────── VERSION="" @@ -37,7 +50,9 @@ TAG="" PACKAGE_NAME="" AUTHOR_NAME="" AUTHOR_EMAIL="" -# CLIFF_CONFIG and OUTPUT_FILE are now sourced from .env +OUTPUT_FILE="debian/changelog" +CLIFF_CONFIG="" +REPO_URL="https://git.0xmax42.io/actions/deb-changelog-action" # ─────────────────────────────────────────────── show_help() { sed -n '2,25p' "$0"; } @@ -53,7 +68,7 @@ while [[ $# -gt 0 ]]; do --output_file) OUTPUT_FILE="$2"; shift 2 ;; --cliff_config) CLIFF_CONFIG="$2"; shift 2 ;; -h|--help) show_help; exit 0 ;; - *) echo "❌ Unknown option: $1"; show_help; exit 1 ;; + *) log_error "Unknown option: $1"; show_help; exit 1 ;; esac done diff --git a/scripts/generate-changelog.sh b/scripts/generate-changelog.sh index 4b5c6cf..96aaf50 100755 --- a/scripts/generate-changelog.sh +++ b/scripts/generate-changelog.sh @@ -34,12 +34,12 @@ show_help() { sed -n '2,18p' "$0"; } # 1 Parse CLI options while [[ $# -gt 0 ]]; do case "$1" in - -c|--config) [[ $# -lt 2 ]] && { echo "❌ $1 requires a value"; exit 1; }; CONFIG_FILE="$2"; shift 2 ;; - -t|--tag) [[ $# -lt 2 ]] && { echo "❌ $1 requires a value"; exit 1; }; TAG="$2"; shift 2 ;; - -o|--out) [[ $# -lt 2 ]] && { echo "❌ $1 requires a value"; exit 1; }; OUT_FILE="$2"; shift 2 ;; + -c|--config) [[ $# -lt 2 ]] && { log_error "$1 requires a value"; exit 1; }; CONFIG_FILE="$2"; shift 2 ;; + -t|--tag) [[ $# -lt 2 ]] && { log_error "$1 requires a value"; exit 1; }; TAG="$2"; shift 2 ;; + -o|--out) [[ $# -lt 2 ]] && { log_error "$1 requires a value"; exit 1; }; OUT_FILE="$2"; shift 2 ;; -d|--debug) DEBUG=true; shift ;; -h|--help) show_help; exit 0 ;; - *) echo "❌ Unknown option: $1"; show_help; exit 1 ;; + *) log_error "Unknown option: $1"; show_help; exit 1 ;; esac done @@ -53,9 +53,7 @@ if [[ "$DEBUG" = false ]]; then fi # 3 Required tools -need() { command -v "$1" >/dev/null || { echo "❌ $1 is required but not installed"; exit 1; }; } -source "$(dirname "$0")/../lib/utils.sh" -source "$(dirname "$0")/../lib/logging.sh" +need() { command -v "$1" >/dev/null || { log_error "$1 is required but not installed"; exit 1; }; } need git; need git-cliff; need sed # 4 Generate changelog