Skip to content

Commit

Permalink
docs: generate static/releases.json (#1594)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
  • Loading branch information
caarlos0 committed Jun 8, 2020
1 parent de71c2a commit df73ead
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@ goreleaser
debug.test
snap.login
site/
www/docs/static/releases.json
6 changes: 6 additions & 0 deletions Makefile
Expand Up @@ -59,6 +59,12 @@ serve:
@docker run --rm -it -p 8000:8000 -v ${PWD}/www:/docs squidfunk/mkdocs-material
.PHONY: serve

vercel:
./scripts/get-releases.sh
pip install mkdocs-material mkdocs-minify-plugin
cd www
mkdocs build

# Show to-do items per file.
todo:
@grep \
Expand Down
21 changes: 21 additions & 0 deletions scripts/get-releases.sh
@@ -0,0 +1,21 @@
#!/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

1 comment on commit df73ead

@vercel
Copy link

@vercel vercel bot commented on df73ead Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.