Architect runs: a generated run every week

scripts/weekly-architect.js picks an HQ in a region the last weeks did not have and
designs each brief against the network a reference architect has built so far, so
every brief asks for something new; the game's own checklist and chaos monkey review
judge it, and the whole run is replayed from the file for three stars. The game
fetches architect/weekly/<key>.json when Puzzles opens, checks it field by field and
writes the briefs' text itself. The Sunday job and the release deploy carry it like
the weekly puzzles and scenarios. Later briefs' cities no longer show early.
This commit is contained in:
Frederic Jung 2026-10-30 13:44:04 +01:00
parent 601f7028bd
commit 4e6e8294d2
No known key found for this signature in database
21 changed files with 461 additions and 17 deletions

View file

@ -1,6 +1,7 @@
name: Weekly puzzle
# Every Sunday morning: make this week's puzzle (scripts/weekly-puzzle.js) and scenario (scripts/weekly-scenario.js),
# Every Sunday morning: make this week's puzzle (scripts/weekly-puzzle.js), scenario (scripts/weekly-scenario.js) and
# Architect run (scripts/weekly-architect.js),
# commit them to main as a data-only change, and redeploy the live release with them, once. Weeks start Sunday
# 06:00 Berlin time; 03:37 UTC is 04:37 in winter and 05:37 in summer, so the files are live before the week starts.
#
@ -47,7 +48,7 @@ jobs:
- run: npm ci
# Weeks already out that main's prices no longer fit are regenerated first, so the new week's history is current.
- name: Fit the published weeks to main
run: node scripts/weekly-puzzle.js --check && node scripts/weekly-scenario.js --check
run: node scripts/weekly-puzzle.js --check && node scripts/weekly-scenario.js --check && node scripts/weekly-architect.js --check
- name: Make the puzzle and the scenario
run: |
set -euo pipefail
@ -55,18 +56,20 @@ jobs:
[[ "$KEY" =~ ^[0-9]{4}-W[0-9]{2}$ ]] || { echo "::error::$KEY is not a week key"; exit 1; }
node scripts/weekly-puzzle.js --key "$KEY"
node scripts/weekly-scenario.js --key "$KEY"
node scripts/weekly-architect.js --key "$KEY"
else
node scripts/weekly-puzzle.js
node scripts/weekly-scenario.js
node scripts/weekly-architect.js
fi
- name: Check every weekly puzzle
run: node scripts/weekly-puzzle.js --check && node scripts/weekly-scenario.js --check && npm test -- tests/weekly-puzzle.test.js tests/puzzles.test.js tests/weekly-scenario.test.js
run: node scripts/weekly-puzzle.js --check && node scripts/weekly-scenario.js --check && node scripts/weekly-architect.js --check && npm test -- tests/weekly-puzzle.test.js tests/puzzles.test.js tests/weekly-scenario.test.js tests/weekly-architect.test.js
- name: Commit it to main
run: |
set -euo pipefail
git add site/puzzles/weekly site/scenarios/weekly
git add site/puzzles/weekly site/scenarios/weekly site/architect/weekly
# Data only: anything else changed means something is wrong.
if git status --porcelain | grep -v -e ' site/puzzles/weekly/' -e ' site/scenarios/weekly/' | grep -q .; then git status --porcelain; echo "::error::unexpected changes"; exit 1; fi
if git status --porcelain | grep -v -e ' site/puzzles/weekly/' -e ' site/scenarios/weekly/' -e ' site/architect/weekly/' | grep -q .; then git status --porcelain; echo "::error::unexpected changes"; exit 1; fi
if git diff --cached --quiet; then echo "Nothing new to commit."; exit 0; fi
git -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
commit -m "Weekly puzzle and scenario $(git diff --cached --name-only | grep -o '[0-9]\{4\}-W[0-9]\{2\}' | sort -u | paste -sd ' ')"