cache-apt-pkgs-action/scripts/release/lib.sh
awalsh128 438c39d8e6
Remove dependency on cache-apt-pkgs-action-ci repo
The action's own workflows (action-tests.yml) already run the same test
jobs as the -ci repo, against the local checkout before merge, so the
separate CI repo is redundant.

- Remove the pub_{master,dev,staging}_push_event.yml workflows that
  dispatched events to the -ci repo (PUBLISH_PUSH_TOKEN secret can be
  deleted from repository settings).
- Point the README test badges at action-tests.yml.
- Port the release-tag tooling (moves the v1 and latest tags) from the
  -ci repo into scripts/release/ and add an update_release_tags
  workflow. Scripts now operate on the current clone instead of
  assuming a sibling checkout, run non-interactively when CI=true, and
  fix the target-tag validation bug in copy_tag.sh.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0112vpMFQJc7Nz7FwE71r5do
2026-10-19 13:06:42 -07:00

55 lines
1.4 KiB
Bash
Executable file

#!/bin/bash
# Shared helpers for the release scripts in this directory.
# Source this file; do not execute it directly.
#######################################
# Yes or no prompt. Auto-confirms when CI=true or ASSUME_YES=1 so the
# scripts can also run from a GitHub workflow.
# Arguments:
# Message to display at prompt.
# Returns:
# 0 on yes, exits the script on no.
#######################################
function confirm_prompt {
if [[ "${CI:-}" == "true" || "${ASSUME_YES:-}" == "1" ]]; then
echo "${1} [auto-confirmed]"
return 0
fi
while true; do
read -r -p "${1} [Y|n] " response
case ${response} in
[Yy]*) return 0 ;;
[Nn]*) exit 0 ;;
*) echo "Invalid option selected." ;;
esac
done
}
#######################################
# Validate argument and exit if invalid.
# Arguments:
# Argument to validate.
# Message to display on error.
# Usage message.
# Returns:
# None, exits non-zero when the argument is empty.
#######################################
function validate_arg {
if [[ -z "${1:-}" ]]; then
printf 'error: %s\n%s\n' "${2}" "${3}" >&2
exit 1
fi
}
#######################################
# Print out command usage.
# Arguments:
# Name of command.
# Parameters.
# Returns:
# Usage message.
#######################################
function usage {
echo "usage: $(basename "${1}") ${2}"
}