Stamp deploy time and enrich version output

After nixos-rebuild switch, write /var/lib/clawd/deploy/last-switch.{time,rev}.

clawdinator-version now optionally fetches OpenClaw commit date via GitHub API when gh is authenticated.
This commit is contained in:
joshp123 2026-02-15 15:47:39 -08:00
parent 55788b92ff
commit c44d54319e
2 changed files with 15 additions and 1 deletions

View File

@ -93,8 +93,22 @@ fi
echo "nix-openclaw: $nix_openclaw_rev (lock age: $(human_age_from_epoch "$nix_openclaw_lm"))"
echo "nixpkgs: $nixpkgs_rev (lock age: $(human_age_from_epoch "$nixpkgs_lm"))"
echo "openclaw: $openclaw_rev"
# Optional: enrich OpenClaw with commit timestamp/age via GitHub API (requires auth).
if [ -n "$openclaw_rev" ] && command -v gh >/dev/null 2>&1; then
if gh auth status -h github.com >/dev/null 2>&1; then
openclaw_date="$(gh api \
-H 'Accept: application/vnd.github+json' \
"/repos/openclaw/openclaw/commits/${openclaw_rev}" \
--jq '.commit.committer.date' 2>/dev/null || true)"
if [ -n "$openclaw_date" ]; then
echo " commit: $openclaw_date ($(human_age_from_iso "$openclaw_date") ago)"
fi
fi
fi
if [ "$#" -ge 1 ] && [ "$1" = "--json" ]; then
jq -c '.' "$info"
fi

View File

@ -24,6 +24,6 @@ for host in "${hosts[@]}"; do
# Run everything under bash -lc so PATH + profiles behave similarly to an interactive session.
# We also force flakes enabled for safety.
bash scripts/aws-ssm-run.sh "${instance_id}" \
"bash -lc 'set -euo pipefail; export NIX_CONFIG=\"experimental-features = nix-command flakes\"; nixos-rebuild switch --accept-flake-config --flake github:openclaw/clawdinators/${rev}#${host}; systemctl is-active clawdinator; test \"$(cat /run/current-system/configurationRevision || true)\" = \"${rev}\"'"
"bash -lc 'set -euo pipefail; export NIX_CONFIG=\"experimental-features = nix-command flakes\"; nixos-rebuild switch --accept-flake-config --flake github:openclaw/clawdinators/${rev}#${host}; systemctl is-active clawdinator; install -d -m 0755 /var/lib/clawd/deploy; date -Is > /var/lib/clawd/deploy/last-switch.time; echo ${rev} > /var/lib/clawd/deploy/last-switch.rev; test \"$(cat /run/current-system/configurationRevision 2>/dev/null || true)\" = \"${rev}\"'"
done