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