Files
horizon-mods/scripts/fetch.sh
Ludovic MarieandClaude Opus 5.5 52e1f7d0f9 The registry: coords_hud, the checks, publishing to Pages, the weekly cleanup
- mods/coords_hud.toml: the SDK's example mod, MIT, built from
  crates/horizon-mod-sdk/examples/coords-hud in Horizon.
- check.yml: a pull request's changes, each new file's checks and a trial
  run in the sandbox, the index it would publish (cargo horizon-mod from
  Horizon at HORIZON_REV).
- publish.yml: on main, new versions become releases, index.json and the
  icons go to GitHub Pages.
- cleanup.yml: staging copies nobody needs, weekly.
- CODEOWNERS, the report form, the pull request template, revoked.toml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 15:01:10 +01:00

27 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Downloads every file the entries list into files/<sha256>: from its own release
# (<id>-<version>) once published, else from the `staging` prerelease, where the
# submission form uploads <sha256>.<extension>. Usage: scripts/fetch.sh [checkout]
# Needs `gh` (GH_TOKEN) and cargo-horizon-mod. FILES_FROM=<dir> reads <dir>/<file>
# instead, for a local trial.
set -euo pipefail
checkout="${1:-.}"
mkdir -p files
cargo horizon-mod registry list "$checkout" | while read -r sha id version file; do
[ -f "files/$sha" ] && continue
ext="${file##*.}"
tmp="$(mktemp -d)"
if [ -n "${FILES_FROM:-}" ]; then
cp "$FILES_FROM/$file" "$tmp/$file"
elif gh release download "$id-$version" --pattern "$file" --dir "$tmp" 2>/dev/null; then
:
elif gh release download staging --pattern "$sha.$ext" --dir "$tmp"; then
mv "$tmp/$sha.$ext" "$tmp/$file"
else
echo "::error::$id $version: $file is neither in release $id-$version nor in staging as $sha.$ext"
exit 1
fi
mv "$tmp/$file" "files/$sha"
rmdir "$tmp"
done