relay/api/console.mjs reads the log intake (miner_logs) and console_items in Neon, the OTA manifest, the CI json and the jobs file from the downloads host (DL_TOKEN in the project env, never in the client), and igneum.network/api/live; 10 s cache per answer. tools/console.mjs: post --kind log|build|note, log, machines, chain, jobs, builds, results, sync-bench, sync-dl, sync-hetzner, sync, url. The two Mac-side build scripts post build events. Screenshots at 375 px and desktop in docs/design/console/. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
63 lines
4.3 KiB
Bash
Executable file
63 lines
4.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Pulls the Windows installer and payload from the latest green run of .github/workflows/windows.yml on master and
|
|
# copies them into the downloads folder (dl/<token>/), where the other packages live. Run on the Mac:
|
|
#
|
|
# packaging/windows/fetch-ci-artifacts.sh [--deploy] [run-id]
|
|
#
|
|
# Without --deploy it prints the deploy command for the main session to run; with --deploy it deploys the folder with
|
|
# the Vercel CLI itself. A run id (gh run list) picks a specific run instead of the latest green one.
|
|
# The installer also goes into the over-the-air update manifest (packaging/ota/publish-manifest.sh, Windows entry;
|
|
# OTA_NOTES= for the changelog line, OTA_SKIP=1 to leave the manifest alone), so the deploy ships both.
|
|
# Reads ~/.config/igneum/dl-token, ~/.config/igneum/dlsite-dir (IGNEUM_DLSITE overrides) and the gh login, which must
|
|
# be igneum-josh (gh auth switch --user igneum-josh).
|
|
set -euo pipefail
|
|
REPO="igneum-network/igneum"
|
|
DEPLOY=0
|
|
RUN_ID=""
|
|
for a in "$@"; do
|
|
case "$a" in --deploy) DEPLOY=1 ;; *) RUN_ID="$a" ;; esac
|
|
done
|
|
TOKEN_FILE="$HOME/.config/igneum/dl-token"
|
|
DLSITE="${IGNEUM_DLSITE:-}"
|
|
[ -n "$DLSITE" ] || { [ -f "$HOME/.config/igneum/dlsite-dir" ] && DLSITE="$(tr -d '[:space:]' < "$HOME/.config/igneum/dlsite-dir")"; } || true
|
|
[ -f "$TOKEN_FILE" ] || { echo "no $TOKEN_FILE" >&2; exit 1; }
|
|
TOKEN="$(tr -d '[:space:]' < "$TOKEN_FILE")"
|
|
DEST="$DLSITE/dl/$TOKEN"
|
|
[ -n "$DLSITE" ] && [ -d "$DEST" ] || { echo "no downloads folder: set IGNEUM_DLSITE or ~/.config/igneum/dlsite-dir (must hold dl/<token>/)" >&2; exit 1; }
|
|
gh auth status 2>&1 | grep -q 'Active account: true' || { echo "gh is not logged in" >&2; exit 1; }
|
|
gh auth status 2>&1 | grep -B1 'Active account: true' | grep -q 'igneum-josh' || { echo "gh active account is not igneum-josh: run gh auth switch --user igneum-josh" >&2; exit 1; }
|
|
|
|
if [ -z "$RUN_ID" ]; then
|
|
RUN_ID="$(gh run list --repo "$REPO" --workflow windows.yml --branch master --status success --limit 1 --json databaseId --jq '.[0].databaseId')"
|
|
[ -n "$RUN_ID" ] && [ "$RUN_ID" != "null" ] || { echo "no green windows.yml run on master yet" >&2; exit 1; }
|
|
fi
|
|
gh run view "$RUN_ID" --repo "$REPO" --json headSha,displayTitle,updatedAt,url,conclusion --jq '"run \(.url)\n\(.displayTitle)\n\(.headSha[0:12]) \(.updatedAt) \(.conclusion)"'
|
|
|
|
TMP="$(mktemp -d)"
|
|
gh run download "$RUN_ID" --repo "$REPO" --name igneum-windows-installer --name igneum-windows-payload --dir "$TMP"
|
|
SETUP="$(find "$TMP" -name 'Igneum-Miner-Setup-*.exe' | head -1)"
|
|
PAYLOAD="$(find "$TMP" -name 'igneum-windows-app.zip' | head -1)"
|
|
[ -n "$SETUP" ] && [ -n "$PAYLOAD" ] || { echo "the run has no installer or payload artifact" >&2; ls -R "$TMP"; exit 1; }
|
|
cp "$SETUP" "$DEST/"
|
|
cp "$PAYLOAD" "$DEST/igneum-windows-app.zip"
|
|
cat > "$DEST/igneum-windows-ci.json" <<JSON
|
|
{ "run": "https://github.com/$REPO/actions/runs/$RUN_ID", "installer": "$(basename "$SETUP")", "payload": "igneum-windows-app.zip", "fetched_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)" }
|
|
JSON
|
|
rm -rf "$TMP"
|
|
echo "copied into $DEST:"
|
|
ls -la "$DEST/$(basename "$SETUP")" "$DEST/igneum-windows-app.zip"
|
|
# the console's Builds tab (relay/): one build event per fetched CI run; never fatal
|
|
node "$(dirname "$0")/../../tools/console.mjs" post --kind build --title "Windows CI $(basename "$SETUP") fetched (run $RUN_ID)" --body "https://github.com/$REPO/actions/runs/$RUN_ID" >/dev/null 2>&1 || true
|
|
# the over-the-air manifest (packaging/ota): the Windows entry for this installer; the Mac entry of the same version is
|
|
# carried over. OTA_NOTES= sets the changelog line; OTA_SKIP=1 leaves the manifest alone.
|
|
if [ "${OTA_SKIP:-0}" != 1 ]; then
|
|
SETUP_VERSION="$(basename "$SETUP" | sed -n 's/^Igneum-Miner-Setup-\(.*\)\.exe$/\1/p')"
|
|
"$(dirname "$0")/../ota/publish-manifest.sh" --version "$SETUP_VERSION" --win "$DEST/$(basename "$SETUP")" --notes "${OTA_NOTES:-Windows build $SETUP_VERSION from CI run $RUN_ID}" --no-deploy
|
|
fi
|
|
if [ "$DEPLOY" = 1 ]; then
|
|
(cd "$DLSITE" && npx vercel@latest --global-config "$HOME/.config/igneum/vercel" deploy --prod --yes 2>&1 | grep -v "$TOKEN" || true)
|
|
echo "live: https://dl.igneum.network/dl/<token>/$(basename "$SETUP")"
|
|
node "$(dirname "$0")/../../tools/console.mjs" sync-dl >/dev/null 2>&1 || true
|
|
else
|
|
echo "deploy: cd $DLSITE && npx vercel@latest --global-config ~/.config/igneum/vercel deploy --prod --yes"
|
|
fi
|