diff options
Diffstat (limited to 'build-helpers.sh')
| -rwxr-xr-x | build-helpers.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/build-helpers.sh b/build-helpers.sh index 36238d5..828c57c 100755 --- a/build-helpers.sh +++ b/build-helpers.sh @@ -64,6 +64,28 @@ get_today_build() { return 1 } +find_single_artifact() { + local dir="$1" + local pattern="$2" + local description="$3" + local artifacts=() + + mapfile -t artifacts < <(find "$dir" -maxdepth 1 -type f -name "$pattern" -print 2>/dev/null | sort) + + if (( ${#artifacts[@]} == 0 )); then + echo "ERROR: No $description produced" >> "$LOGFILE" + return 1 + fi + + if (( ${#artifacts[@]} > 1 )); then + echo "ERROR: Multiple $description files found; refusing to guess which one to publish" >> "$LOGFILE" + printf ' %s\n' "${artifacts[@]}" >> "$LOGFILE" + return 1 + fi + + printf '%s\n' "${artifacts[0]}" +} + has_today_remote_arm64() { ssh "$REMOTE" " for f in $REMOTE_DIR/$ZIP_NAME; do @@ -689,6 +711,40 @@ verify_remote() { echo "✅ Remote verification successful" } +run_stats() { + echo "Regenerating stats (best effort)..." + + ensure_all_diffs # only depends on packages.txt + rebuild_metrics # skips missing safely + generate_index # renders whatever exists +} + +run_sync() { + echo "Starting sync to remote..." + + # Safety check + if [[ -z "${REMOTE_TARGET:-}" ]]; then + echo "ERROR: REMOTE_TARGET not set" + return 1 + fi + + if [[ ! -d "$OUTPUT_DIR" ]]; then + echo "ERROR: OUTPUT_DIR does not exist" + return 1 + fi + + # Perform rsync (mirror mode) + rsync -avz --delete "$OUTPUT_DIR/" "$REMOTE_TARGET" + + # Optional: verify after sync + verify_remote || { + echo "ERROR: Remote verification failed" + return 1 + } + + echo "Sync complete" +} + extract_date() { local name="$1" [[ "$name" =~ ^([0-9]{4}-[0-9]{2}-[0-9]{2}) ]] && echo "${BASH_REMATCH[1]}" |
