1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00
goreleaser/scripts/get-releases.sh
Carlos Alexandro Becker 35c71b6522 fix: docs script
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2021-02-10 16:03:30 -03:00

22 lines
509 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
url="https://api.github.com/repos/goreleaser/goreleaser/releases"
get_last_page() {
curl -sSf -I -H "Authorization: Bearer $GITHUB_TOKEN" \
"$url" |
grep -E '^link: ' |
sed -e 's/^link:.*page=//g' -e 's/>.*$//g'
}
last_page="$(get_last_page)"
tmp="$(mktemp -d)"
for i in $(seq 1 "$last_page"); do
echo "page: $i"
curl -H "Authorization: Bearer $GITHUB_TOKEN" -sSf "$url?page=$i" >"$tmp/$i.json"
done
jq '[inputs] | add' "$tmp"/*.json >www/docs/static/releases.json