From a6bf4d915866d9243c0e9263dc7a6f00ef547d20 Mon Sep 17 00:00:00 2001 From: Michael Mitchell Date: Sun, 8 Nov 2026 18:32:47 -0800 Subject: [PATCH 1/2] ci: align dependency maintenance and release verification --- .github/dependabot.yml | 16 ++++++++++++++++ .github/workflows/check.yml | 19 ++++++++++++++----- .github/workflows/pages.yml | 20 ++++++++++++-------- .github/workflows/release.yml | 12 +++++++----- docs/distribution.md | 22 ++++++++++++++++++---- 5 files changed, 67 insertions(+), 22 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..67670b6 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: pip + directory: / + schedule: + interval: weekly + groups: + python-build-tools: + patterns: ['*'] + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + groups: + github-actions: + patterns: ['*'] diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 940d5f8..23c29a7 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,27 +1,36 @@ name: Check Agent Warcraft -on: [push, pull_request] +on: + push: + branches: [main] + pull_request: + workflow_dispatch: permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: test: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] node: [22, 24] + timeout-minutes: 20 runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v7 - - uses: actions/setup-node@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node }} - run: npm run check - run: npm test - run: npm run test:package - - uses: actions/setup-python@v7 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: '3.12' - run: python -m pip install -r requirements-dev.txt - run: python scripts/build-audio.py --check - run: python scripts/check-pet.py - - run: python scripts/package-pet.py + - run: python scripts/build-assets.py --check + - run: python scripts/package-release.py - run: npm run site diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 0d44b9b..4e11522 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -13,6 +13,7 @@ concurrency: cancel-in-progress: true jobs: build: + timeout-minutes: 15 if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' runs-on: ubuntu-latest permissions: @@ -23,15 +24,17 @@ jobs: id: release env: GH_TOKEN: ${{ github.token }} - # Before the first release, publish the pushed commit instead. - run: echo "tag=$(gh release view -R "$GITHUB_REPOSITORY" --json tagName --jq .tagName 2>/dev/null || true)" >> "$GITHUB_OUTPUT" - - uses: actions/checkout@v7 + run: | + release_tag=$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq .tag_name) + test -n "$release_tag" + echo "tag=$release_tag" >> "$GITHUB_OUTPUT" + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ steps.release.outputs.tag }} - - uses: actions/setup-node@v7 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24 - - uses: actions/setup-python@v7 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: '3.12' - run: npm run check @@ -39,11 +42,12 @@ jobs: - run: python -m pip install -r requirements-dev.txt - run: python scripts/check-pet.py - run: npm run site - - uses: actions/configure-pages@v5 - - uses: actions/upload-pages-artifact@v4 + - uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 + - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 with: path: dist/site deploy: + timeout-minutes: 10 needs: build runs-on: ubuntu-latest permissions: @@ -54,5 +58,5 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - - uses: actions/deploy-pages@v4 + - uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 id: deployment diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f95e99e..bd5ace6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,34 +9,36 @@ concurrency: cancel-in-progress: false jobs: verify: + timeout-minutes: 20 strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] node: [22, 24] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v7 - - uses: actions/setup-node@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node }} - run: npm run check - run: npm test - run: npm run test:package publish: + timeout-minutes: 15 needs: verify runs-on: ubuntu-latest permissions: contents: write steps: - - uses: actions/checkout@v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: Require a commit merged into main run: git merge-base --is-ancestor HEAD origin/main - - uses: actions/setup-node@v7 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: 24 - - uses: actions/setup-python@v7 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: '3.12' - run: python -m pip install -r requirements-dev.txt diff --git a/docs/distribution.md b/docs/distribution.md index 7e8a82a..88428c6 100644 --- a/docs/distribution.md +++ b/docs/distribution.md @@ -16,8 +16,9 @@ changelog, and run the contributor checks. After its PR merges into `main`, tag the merged commit and push the tag: ```bash -git tag v0.2.0 -git push origin v0.2.0 +release_tag="v$(node -p "require('./package.json').version")" +git tag "$release_tag" +git push origin "$release_tag" ``` The release workflow checks Node 22/24 on macOS, Linux, and Windows, including @@ -89,8 +90,9 @@ No analytics, third-party fonts, or runtime telemetry are loaded; `site/fonts` holds the OFL-licensed faces. The Pages workflow checks out the latest published release tag, validates, and -builds before deployment. Before the first release it publishes the pushed -commit. It runs after successful releases, on main updates, or manually. +builds before deployment. A failed release lookup stops deployment; only +published release tags are deployed. It runs after successful releases, on +main updates, or manually. The repository homepage points to `https://mitchtech.github.io/agent-warcraft/`. Its social card is also available at `https://mitchtech.github.io/agent-warcraft/previews/social.png`. @@ -140,3 +142,15 @@ both characters before packaging. Preserve the source PNG in `assets/original/peasant` and update `assets/peasant-pet-revision.json` when replacing Peasant artwork. `agent-warcraft pet install peasant` installs it from the package; the [Peasant guide](peasant.md) also describes manual installation. + +## Automated maintenance + +PR checks run the Node 22/24 matrix on Linux, macOS, and Windows, including +preview pixel verification and a full release package build. New commits +cancel superseded checks on the same PR. Release publication still requires +matching manifest/tag versions and a commit merged into `main`. + +Dependabot checks Python build dependencies and GitHub Actions weekly, with +one grouped PR per ecosystem. Security updates remain enabled independently. +Actions use immutable commit pins with version comments so Dependabot can +update them. Review required checks before merging dependency updates. From df1b8886b080ebcdcb2e8e736293d0b327d6c715 Mon Sep 17 00:00:00 2001 From: Michael Mitchell Date: Sun, 8 Nov 2026 18:37:11 -0800 Subject: [PATCH 2/2] fix: preserve UTF-8 text in Windows release builds --- scripts/package-release.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/package-release.py b/scripts/package-release.py index c76873a..56cf9d1 100644 --- a/scripts/package-release.py +++ b/scripts/package-release.py @@ -19,7 +19,7 @@ def main(): if OUT.exists(): shutil.rmtree(OUT) archive = pet.package(OUT, with_package=True) - version = json.loads((ROOT / "package.json").read_text())["version"] + version = json.loads((ROOT / "package.json").read_text(encoding="utf-8"))["version"] if archive: shutil.copyfile(archive, OUT / "agent-warcraft-pet.zip") peasant_archive = pet.package(OUT, pet_id="peasant") @@ -50,10 +50,10 @@ def main(): if web.exists(): shutil.copyfile(web, OUT / web.name) artifacts = sorted(path for path in OUT.iterdir() if path.name != "SHA256SUMS") - (OUT / "SHA256SUMS").write_text("".join(f"{hashlib.sha256(path.read_bytes()).hexdigest()} {path.name}\n" for path in artifacts)) - changelog = (ROOT / "CHANGELOG.md").read_text() + (OUT / "SHA256SUMS").write_text("".join(f"{hashlib.sha256(path.read_bytes()).hexdigest()} {path.name}\n" for path in artifacts), encoding="utf-8", newline="\n") + changelog = (ROOT / "CHANGELOG.md").read_text(encoding="utf-8") section = changelog.split(f"## {version} - ", 1)[1].split("\n## ", 1)[0].split("\n", 1)[1].lstrip("\n") - (ROOT / "dist" / "release-notes.md").write_text(section) + (ROOT / "dist" / "release-notes.md").write_text(section, encoding="utf-8", newline="\n") print(f"Built {len(artifacts)} release assets and checksums in {OUT}")