#!/usr/bin/env bash # Pulls the current image tag and brings up the compose stack. # Expects GITHUB_PAT, FETCHER_INTERNAL_TOKEN, and IMAGE_TAG to be present in # the environment (exported by the GitHub Actions deploy job). set -euo pipefail cd "$(dirname "$0")" mkdir -p "$HOME/ghstats/data/fetcher" "$HOME/ghstats/data/generator" docker compose pull # Keep fetcher-cron stopped across a deploy if an operator stopped it (e.g. # during a sign-up spike); otherwise the recreated container runs at once. cron_was_stopped=$(docker inspect -f '{{.State.Status}}' ghstats-fetcher-cron 2>/dev/null | grep -qx exited && echo 1 || true) docker compose up -d --remove-orphans if [ -n "$cron_was_stopped" ]; then docker stop ghstats-fetcher-cron; fi docker compose ps