windows.yml: parse job (every .ps1 through the Windows PowerShell 5.1 parser with a negative fixture, PSScriptAnalyzer as warnings, parenthesis check of every .bat/.cmd with a negative fixture), build job (engine on the MSVC target, window host through BUILD-APP.bat as it is, payload through make-payload.sh in Git Bash, installer through build-installer.ps1, smoke run of both exes, launcher DRY_RUN, three artifacts for 90 days). push-inputs.sh publishes payload-inputs.zip (node, miner, workers, NVRTC DLLs) to the downloads host from the Mac; fetch-ci-artifacts.sh pulls the green run's installer and payload back into the downloads folder. Host: --version and --help, version.h shared with host.rc. Launcher: DRY_RUN=1 prints the plan and starts nothing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
52 lines
3.2 KiB
Bash
Executable file
52 lines
3.2 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.
|
|
# Reads ~/.config/igneum/dl-token, ~/.config/igneum/dlsite-dir (IGNEUM_DLSITE overrides) and the gh login, which must
|
|
# be igneum-labs (gh auth switch --user igneum-labs).
|
|
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-labs' || { echo "gh active account is not igneum-labs: run gh auth switch --user igneum-labs" >&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"
|
|
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")"
|
|
else
|
|
echo "deploy: cd $DLSITE && npx vercel@latest --global-config ~/.config/igneum/vercel deploy --prod --yes"
|
|
fi
|