forgejo-release.sh: Allow arguments to be checked in check_dependencies

This allows us to pass in extra dependencies in testing scenarios. In this case sign_release requires gpg to run.
This commit is contained in:
Jack Greiner 2025-10-09 16:59:55 -04:00
parent 8cfa95b448
commit fc4e870d23
No known key found for this signature in database
GPG key ID: F34343A8F6B33E1E

View file

@ -43,8 +43,16 @@ get_arch() {
} }
check_dependencies() { check_dependencies() {
# Always required for API parsing and downloads
deps="curl jq"
# Append any extra arguments to the list of dependencies to check
if [ "$#" -gt 0 ]; then
deps="$deps $*"
fi
missing="" missing=""
for cmd in curl jq; do for cmd in $deps; do
if ! command -v "$cmd" >/dev/null 2>&1; then if ! command -v "$cmd" >/dev/null 2>&1; then
missing="$missing $cmd" missing="$missing $cmd"
fi fi
@ -165,6 +173,7 @@ maybe_use_release_note_assistant() {
} }
sign_release() { sign_release() {
check_dependencies gpg
passphrase="" passphrase=""
if [ -s "$GPG_PASSPHRASE" ]; then if [ -s "$GPG_PASSPHRASE" ]; then
passphrase="--passphrase-file $GPG_PASSPHRASE" passphrase="--passphrase-file $GPG_PASSPHRASE"