1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2024-12-31 01:53:50 +02:00
goreleaser/scripts/get-releases.sh
Carlos Alexandro Becker df73ead056
docs: generate static/releases.json (#1594)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2020-06-08 19:48:10 +00:00

22 lines
507 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
url="https://api.github.com/repos/goreleaser/goreleaser/releases"
get_last_page() {
curl -sf -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" -sf "$url?page=$i" >"$tmp/$i.json"
done
jq '[inputs] | add' "$tmp"/*.json >www/docs/static/releases.json