#!/usr/bin/env bash # Record a release step's wall clock, including failures, for the final summary. # Source this at the beginning of each run step; trap EXIT preserves its status. COTTON_STEP_STARTED="$(date +%s)" COTTON_STEP_LOG="${RUNNER_TEMP:?}/release-step-times.tsv" cotton_step_finished() { local result=$? elapsed elapsed=$(( $(date +%s) - COTTON_STEP_STARTED )) printf '%s\t%s\t%s\n' "$elapsed" "$result" "${COTTON_STEP_NAME:?}" >> "$COTTON_STEP_LOG" return "$result" } trap cotton_step_finished EXIT