#!/usr/bin/env bash # Render every report image on the homepage from this bino project. # ./build.sh needs bino (0.100.0 or later), pdftoppm (poppler) and ImageMagick # Output goes to ../src/assets/showcase/ (Astro turns the PNGs into WebP/AVIF) and the # PDF and a copy of this project's files to ../public/showcase/. set -euo pipefail cd "$(dirname "$0")" # REPORT_MONTH is set per build below; a value from the calling shell would leak into the others unset REPORT_MONTH ASSETS=../src/assets/showcase PUBLIC=../public/showcase rm -rf dist out "$ASSETS/months" "$ASSETS/pages" "$ASSETS/shots" mkdir -p "$ASSETS/months" "$ASSETS/pages" "$ASSETS/shots" "$PUBLIC" out python3 scripts/make_data.py bino lint --no-color # The full report: four pages, the whole year bino build --artefact kestrel --no-color > out/kestrel.log tail -n 3 out/kestrel.log # the log of this build is printed on the homepage cp out/kestrel.log "$ASSETS/build.log" cp dist/kestrel-2025.pdf "$PUBLIC/" pdftoppm -png -r 150 dist/kestrel-2025.pdf out/page for i in 1 2 3 4; do magick "out/page-$i.png" -strip "$ASSETS/pages/page-$i.png" done # The same one-page report, built once for every month of the year. # months.json keeps the time bino reported for each build; the homepage prints it. echo "[" > "$ASSETS/months.json" for m in $(seq 1 12); do REPORT_MONTH=$m bino build --artefact monthly --no-color > out/month.log pdftoppm -png -r 150 -singlefile dist/kestrel-monthly.pdf "out/month" magick out/month.png -strip "$ASSETS/months/month-$(printf %02d "$m").png" took="$(sed -n 's/.*Build complete in \(.*\)$/\1/p' out/month.log)" sep=","; [[ $m == 12 ]] && sep="" echo " {\"month\": $m, \"took\": \"$took\"}$sep" >> "$ASSETS/months.json" done echo "]" >> "$ASSETS/months.json" # One PNG per component, transparent background. Built for August, so the time chart # shows actual and forecast, like the page on the homepage next to it. REPORT_MONTH=8 bino build --artefact gallery --no-color | tail -n 3 REPORT_MONTH=8 bino build --artefact gallery_xga --no-color | tail -n 3 for f in dist/kestrel-*_*.png; do name="${f#dist/kestrel-}" magick "$f" -trim +repage -strip "$ASSETS/shots/$name" done # The source files, so visitors can read what built the images rm -rf "$PUBLIC/files" mkdir -p "$PUBLIC/files" cp -R bino.toml build.sh data datasources datasets components pages reports styles scripts "$PUBLIC/files/" ls -la "$ASSETS"/*/