saladday1's picture
code: sync from git 9bc5001 daily job also builds and deploys the page when web/ changed (version.json on the Space; Node 22.22.2); push_code stops instead of overwriting others' changes in code/ (--c
0ef6066 verified
Raw History Blame Contribute Delete
1.05 kB
#!/usr/bin/env bash
# Entry point for the scheduled HF Job (image python:3.12, secret HF_TOKEN).
# Pulls the code from the dataset repo, runs the daily pipeline with --push, then rebuilds and
# deploys the page when web/ changed since what the Space serves.
set -euo pipefail
pip install -q "huggingface_hub>=1.17,<3" pandas pyarrow numpy requests httpx pyyaml duckdb
hf download MiniMaxAI/oss-ecosystem-data --repo-type dataset --include "code/*" --local-dir /w
cd /w/code
HFECO_LOCAL=/w/data python scripts/daily.py "${@:---push}"
# The page, after the data: a failed build fails the job but leaves today's data in and the
# live page as it was. Only a pushing run deploys (a local test without --push does not).
if [[ " ${*:---push} " == *" --push "* ]] && python scripts/deploy_space.py --changed; then
NODE=node-v22.22.2-linux-x64 # the version the page is built with on the dev machine
curl -fsSL "https://nodejs.org/dist/v22.22.2/$NODE.tar.xz" | tar -xJ -C /opt
export PATH="/opt/$NODE/bin:$PATH"
python scripts/deploy_space.py --ci
fi