#!/usr/bin/env bash
# Real demos for P222 "GitHub Actions: Full Tutorial for Beginners". Made on the Mac (Docker Desktop).
# One laptop (lab/Dockerfile: stock Ubuntu 24.04 with Ubuntu's git and Python 3.12, and the GitHub CLI from
# GitHub's own apt repository), with a small Python app, todo-app (lab/app). GitHub is real: the app lives in the lab
# repository cloudexplainers/actions-tutorial-lab, and every workflow run on screen ran on GitHub's own runners.
# The repository is reset at the start (runs, releases, tags, secrets), so this can be run again.
# The workflow files for each step are in lab/steps/; demo_driver.py types every command in a real bash in a pty.
set -euo pipefail
cd "$(dirname "$0")"
P=ce-p222
cleanup() { docker rm -f $P-laptop >/dev/null 2>&1 || true; }
cleanup
[ -n "${KEEP:-}" ] || trap cleanup EXIT
docker build -q -t ce-p222-laptop lab >/dev/null
docker run -d --name $P-laptop --hostname laptop ce-p222-laptop sleep infinity >/dev/null
python3 demo_driver.py "$P"
