Skip to content

ci(workflows): build and deploy via GitHub Actions#48

Merged
kvaps merged 2 commits into
masterfrom
ci-github-pages
Jun 4, 2026
Merged

ci(workflows): build and deploy via GitHub Actions#48
kvaps merged 2 commits into
masterfrom
ci-github-pages

Conversation

@kvaps
Copy link
Copy Markdown
Member

@kvaps kvaps commented Jun 4, 2026

What

  • Add a GitHub Actions workflow that compiles the game from sources and deploys it to GitHub Pages on every push to master
  • Remove the compiled artifacts (candybox2.js, candybox2_uncompressed.js, code/gen/*) from the repository

Why

Until now the compiled JavaScript had to be built locally and committed, which required a 2013-era toolchain (old tsc + yuicompressor). In practice this meant translation PRs (e.g. #46) had no effect on the live site until someone rebuilt the game, and contributors could not compile it at all: TypeScript 1.8+ rejects the this-in-super()-arguments pattern used throughout the code base (TS17009). The committed code/gen/genText.ts was already stale.

How it works

The workflow mirrors compile.sh:

  1. genAscii.py / genText.py generate code/gen/*.ts from ascii/ and text/
  2. TypeScript 1.7.5 (the last release that compiles the code base cleanly) builds the bundle
  3. terser minifies it (replacing yuicompressor), the license header is prepended to both candybox2.js and candybox2_uncompressed.js
  4. The repository tree plus the built files is uploaded as the Pages artifact

The built game was verified locally in a browser: it loads, runs without console errors, and the Italian translation from #46 is selectable.

Notes

  • The Pages source must be switched to "GitHub Actions" in the repository settings (the configure-pages step does this on the first run; switching it before merging avoids the legacy branch build briefly publishing a site without candybox2.js)
  • compile.sh is kept untouched for local builds

kvaps and others added 2 commits June 4, 2026 20:03
Compile the game from sources on every push to master and publish
the result to GitHub Pages, so translation PRs no longer require
contributors to compile the game locally.

The pipeline mirrors compile.sh: generate genAscii.ts/genText.ts with
the existing python scripts, compile with TypeScript 1.7.5 (the last
release that accepts the 2013-era 'this in super arguments' pattern
used by the code base), minify with terser and prepend the license.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
candybox2.js, candybox2_uncompressed.js and code/gen/* are now built
and deployed by the GitHub Actions workflow. The committed copies were
already stale: code/gen/genText.ts did not include the recently merged
Italian translation.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps kvaps marked this pull request as ready for review June 4, 2026 18:17
@kvaps kvaps merged commit 35301d4 into master Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant