Files
coa-pack/tools/list_releases.sh

43 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# List the most-recent release tag for every includable repo in manifest.yaml.
# Pure read-only via Gitea API. No auth needed - the Exiles org repos are public.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
MANIFEST="$REPO_ROOT/manifest.yaml"
API="https://git.sub-net.at/api/v1"
ORG="Exiles"
# Same minimal-awk parser as build_pack.sh.
manifest_includes() {
awk '
/^[[:space:]]*-[[:space:]]*repo:[[:space:]]*/ {
sub(/^[[:space:]]*-[[:space:]]*repo:[[:space:]]*/, "")
gsub(/[[:space:]]+$/, "")
repo = $0; include = ""; next
}
/^[[:space:]]+include:[[:space:]]*/ {
sub(/^[[:space:]]+include:[[:space:]]*/, "")
gsub(/[[:space:]]+$/, "")
include = $0
if (repo != "" && include == "true") { print repo }
repo = ""; include = ""
}
' "$MANIFEST"
}
while read -r repo; do
[ -z "$repo" ] && continue
json="$(curl -fsS "$API/repos/$ORG/$repo/releases?limit=1" 2>/dev/null || echo '[]')"
tag="$(printf '%s' "$json" | jq -r '.[0].tag_name // empty')"
date="$(printf '%s' "$json" | jq -r '.[0].published_at // empty' | cut -dT -f1)"
if [ -z "$tag" ]; then
printf '%-30s (no releases)\n' "$repo"
else
printf '%-30s %-20s %s\n' "$repo" "$tag" "$date"
fi
done < <(manifest_includes)