All checks were successful
Build and deploy static pages / build-and-push (push) Successful in 19s
100 lines
3.1 KiB
Bash
Executable File
100 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Full build pipeline: fetch rankings → fetch deadlines → generate content → hugo build.
|
|
#
|
|
# Usage:
|
|
# ./build.sh # full build (all topics)
|
|
# ./build.sh --topic cloud-edge # process one topic only
|
|
# ./build.sh --skip-rankings # use cached CSVs
|
|
# ./build.sh --skip-deadlines # use cached deadlines.yaml
|
|
# ./build.sh --dev # run hugo server instead of building
|
|
# ./build.sh --query "edge cloud" # pass keyword to ICORE fetch
|
|
|
|
set -euo pipefail
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
cd "$ROOT_DIR"
|
|
|
|
ICORE_QUERY=""
|
|
SKIP_RANKINGS=0
|
|
SKIP_DEADLINES=0
|
|
HUGO_MODE="build"
|
|
TOPIC=""
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--query) ICORE_QUERY="$2"; shift 2 ;;
|
|
--skip-rankings) SKIP_RANKINGS=1; shift ;;
|
|
--skip-deadlines) SKIP_DEADLINES=1; shift ;;
|
|
--dev) HUGO_MODE="serve"; shift ;;
|
|
--topic) TOPIC="$2"; shift 2 ;;
|
|
*) echo "Unknown option: $1"; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
# Ensure uv environment is ready
|
|
uv sync --quiet
|
|
|
|
# Rankings are shared across all topics — fetch once
|
|
if [[ $SKIP_RANKINGS -eq 0 ]]; then
|
|
echo "==> Fetching ICORE rankings …"
|
|
uv run pa-fetch-icore --query "$ICORE_QUERY"
|
|
|
|
echo "==> Fetching SCImago rankings …"
|
|
uv run pa-fetch-scimago || echo " WARNING: SCImago fetch failed (anti-bot). Using cached/inline data."
|
|
fi
|
|
|
|
# Discover topics: either the single --topic flag or all from topics.yaml
|
|
if [[ -n "$TOPIC" ]]; then
|
|
TOPICS=("$TOPIC")
|
|
else
|
|
mapfile -t TOPICS < <(uv run python -c "
|
|
import yaml
|
|
data = yaml.safe_load(open('site/data/topics.yaml')) or {}
|
|
for t in data.get('topics', []):
|
|
print(t['slug'])
|
|
")
|
|
fi
|
|
|
|
for TOPIC_SLUG in "${TOPICS[@]}"; do
|
|
echo ""
|
|
echo "==> Processing topic: $TOPIC_SLUG"
|
|
|
|
DATA_DIR="site/data/${TOPIC_SLUG}"
|
|
CONTENT_DIR="site/content/${TOPIC_SLUG}"
|
|
BASE_PATH="/${TOPIC_SLUG}"
|
|
|
|
if [[ $SKIP_DEADLINES -eq 0 ]]; then
|
|
# Only run if venues.yaml has at least one conference
|
|
if uv run python -c "
|
|
import yaml, sys
|
|
v = yaml.safe_load(open('${DATA_DIR}/venues.yaml'))
|
|
sys.exit(0 if (v or {}).get('conferences') else 1)
|
|
" 2>/dev/null; then
|
|
echo " --> Fetching deadlines …"
|
|
uv run pa-fetch-deadlines \
|
|
--venues "${DATA_DIR}/venues.yaml" \
|
|
--output "${DATA_DIR}/deadlines.yaml"
|
|
else
|
|
echo " --> Skipping deadlines (no conferences in venues.yaml)"
|
|
fi
|
|
fi
|
|
|
|
echo " --> Generating Hugo content …"
|
|
uv run pa-generate \
|
|
--venues "${DATA_DIR}/venues.yaml" \
|
|
--deadlines "${DATA_DIR}/deadlines.yaml" \
|
|
--papers-dir "${DATA_DIR}/papers" \
|
|
--icore "site/data/rankings/icore.csv" \
|
|
--scimago "site/data/rankings/scimago.csv" \
|
|
--content "${CONTENT_DIR}" \
|
|
--base-path "${BASE_PATH}"
|
|
done
|
|
|
|
echo ""
|
|
echo "==> Building Hugo site …"
|
|
if [[ "$HUGO_MODE" == "serve" ]]; then
|
|
hugo --source site server --buildDrafts --bind 0.0.0.0
|
|
else
|
|
hugo --source site --minify
|
|
echo "==> Site built in site/public/"
|
|
fi
|