Deploy: download papers.db from the package registry (11 parts, sha256-verified)
Deploy / deploy (push) Successful in 5m0s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbMbJPadPzVwvt9rU9GBNo
This commit is contained in:
2026-10-22 15:10:08 +00:00
parent 23bb8113d1
commit 52d1e284a8
2 changed files with 15 additions and 1 deletions
+14 -1
View File
@@ -21,7 +21,20 @@ mkdir -p "$ROOT/releases"
rm -rf "$REL"; mkdir -p "$REL"
tar --exclude=.git --exclude=node_modules --exclude=.next -cf - . | tar -xf - -C "$REL"
cd "$REL"
test -s data/papers.db || { echo "data/papers.db missing or empty" >&2; exit 1; }
# data/papers.db is not in git: fetch it (checksum-verified) from the Gitea package registry.
VER=$(cat data/DB_VERSION); PARTS=$(cat data/DB_PARTS)
CACHE="$ROOT/data/$VER"
if [ ! -s "$CACHE/papers.db" ]; then
mkdir -p "$CACHE"; rm -f "$CACHE"/part.* "$CACHE/papers.db.tmp"
URL="${GITHUB_SERVER_URL:-https://gitea.entroia.com}/api/packages/claude-bot/generic/llm-survey-data/$VER"
i=0; while [ "$i" -lt "$PARTS" ]; do
n=$(printf 'part.%02d' "$i"); curl -fsS --retry 3 -o "$CACHE/$n" "$URL/$n"; i=$((i+1))
done
cat "$CACHE"/part.* | gunzip > "$CACHE/papers.db.tmp"
[ "$(sha256sum "$CACHE/papers.db.tmp" | cut -d' ' -f1)" = "$VER" ] || { echo "papers.db checksum mismatch" >&2; exit 1; }
mv "$CACHE/papers.db.tmp" "$CACHE/papers.db"; rm -f "$CACHE"/part.*
fi
mkdir -p data && cp "$CACHE/papers.db" data/papers.db
npm ci --no-audit --no-fund
npm run build
node -e 'const D=require("better-sqlite3");const d=new D("data/papers.db",{readonly:true});console.log("papers:",d.prepare("select count(*) c from papers").get().c)'