From e095403b2e52ddde0b49d1580d659f653690f125 Mon Sep 17 00:00:00 2001 From: Juan Pa Date: Wed, 2 Dec 2026 21:46:14 -0800 Subject: [PATCH] feat(web): publish the Web build of main to GitHub Pages A deploy-pages job in the Build workflow unpacks the Web artifact of every push to main (or a manual run) and deploys it to GitHub Pages. The Web preset leaves out the */sources/ and */source/ art masters no game loads, which takes the pack from ~360 MB to 193 MB, and adds a page description. The hub shows no Quit Game in a browser, as in booth mode, and the router ignores a quit there. Docs point at the live URL; test_exports.py checks the preset's exclude filter. --- .github/workflows/build.yml | 40 ++++++++++++++++++- README.md | 4 +- docs/builds.md | 11 +++-- docs/main-menu.md | 2 +- hoppys-adventure-arcade/app/app_router.gd | 8 +++- hoppys-adventure-arcade/export_presets.cfg | 4 +- .../scenes/main_menu/main_menu.gd | 6 +-- tools/build/test_exports.py | 9 +++++ 8 files changed, 71 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c8408f28..4d033b24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,8 @@ name: Build # Exports macOS, Windows, Linux and Web builds with tools/build/export_game.py and boots the Linux # build headless through every route. Every PR is export-checked; downloadable builds are kept -# for main, v* tags, manual runs and PRs labelled `preview-build`. A v* tag publishes a release. +# for main, v* tags, manual runs and PRs labelled `preview-build`. A v* tag publishes a release, +# and every push to main publishes the Web build to GitHub Pages. on: pull_request: types: [opened, synchronize, reopened, labeled] @@ -99,6 +100,43 @@ jobs: retention-days: ${{ env.RETENTION_DAYS }} if-no-files-found: error + # The Web build of main goes live at https://coderabbitai.github.io/coderabbit-arcade/. + # The repository's Pages source must be "GitHub Actions" for the deployment to be accepted. + pages: + name: deploy-pages + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch' + needs: export + runs-on: ubuntu-24.04 + timeout-minutes: 15 + permissions: + pages: write + id-token: write + concurrency: + group: pages + cancel-in-progress: false + environment: + name: github-pages + url: ${{ steps.deploy.outputs.page_url }} + steps: + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: hoppys-adventure-arcade-web + path: dist + - name: Unpack the Web build + run: | + cd dist + sha256sum --check --ignore-missing SHA256SUMS.txt + mkdir ../site + unzip -q ./*-web.zip -d ../site + test -f ../site/index.html + touch ../site/.nojekyll + - uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 + - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: site + - id: deploy + uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 + release: name: release if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v') diff --git a/README.md b/README.md index 5ccbbd7e..88afcefa 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,9 @@ In Orbital Ops' zero-gravity bay, hold Jump or Up to rise, hold Down to descend, ## Builds -Versioned macOS, Windows, Linux and Web builds come from the [Build workflow](.github/workflows/build.yml): releases for `v*` tags, artifacts for every `main` push, and preview builds for PRs labelled `preview-build`. To build locally, run `python3 tools/build/export_game.py --smoke`. See [docs/builds.md](docs/builds.md). +**Play in your browser:** the latest `main` is live at [coderabbitai.github.io/coderabbit-arcade](https://coderabbitai.github.io/coderabbit-arcade/) (WebGL 2; click once to start the audio). + +Versioned macOS, Windows, Linux and Web builds come from the [Build workflow](.github/workflows/build.yml): releases for `v*` tags, artifacts for every `main` push, the Web build of every `main` push on GitHub Pages, and preview builds for PRs labelled `preview-build`. To build locally, run `python3 tools/build/export_game.py --smoke`. See [docs/builds.md](docs/builds.md). ### Run it at a booth diff --git a/docs/builds.md b/docs/builds.md index 186c1698..cce4d6b7 100644 --- a/docs/builds.md +++ b/docs/builds.md @@ -6,6 +6,7 @@ Playable builds come from `tools/build/export_game.py`, both locally and in the | You want | Where | |---|---| +| To play in a browser | **[coderabbitai.github.io/coderabbit-arcade](https://coderabbitai.github.io/coderabbit-arcade/)**: the Web build of the latest `main`, published by the workflow's `deploy-pages` job. | | A specific release | **Releases**. Tag `v` and the workflow publishes macOS, Windows, Linux and Web zips as a prerelease. | | The latest `main` | **Actions → Build →** the newest run on `main` → **Artifacts**. Kept for 30 days. | | A pull request's build | Add the `preview-build` label to the PR; the run's artifacts are kept for 7 days. Every PR is export-checked either way. | @@ -20,7 +21,11 @@ Each platform is its own artifact: `hoppys-adventure-arcade-macos`, `-windows`, ``` - **Windows** (x86_64): unzip and run `HoppysAdventureArcade.exe`. SmartScreen may ask you to confirm (**More info → Run anyway**), because the build isn't code-signed. - **Linux** (x86_64): unzip and run `./HoppysAdventureArcade.x86_64` (use `chmod +x HoppysAdventureArcade.x86_64` if your unzip tool drops executable permissions). -- **Web**: extract the whole zip, run `python3 -m http.server 8000 --bind 127.0.0.1` in that folder, and open `http://localhost:8000`. Opening `index.html` directly will not work. For shared hosting, serve the entire folder over HTTPS. This is a single-threaded WebGL 2 build, so it does not need cross-origin isolation headers. Click the game to enable audio. See [Godot's Web export documentation](https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_web.html). +- **Web**: extract the whole zip, run `python3 -m http.server 8000 --bind 127.0.0.1` in that folder, and open `http://localhost:8000`. Opening `index.html` directly will not work. For shared hosting, serve the entire folder over HTTPS. This is a single-threaded WebGL 2 build, so it does not need cross-origin isolation headers, which is what lets GitHub Pages host it. Click the game to enable audio. The hub has no Quit Game button in a browser. See [Godot's Web export documentation](https://docs.godotengine.org/en/stable/tutorials/export/exporting_for_web.html). + +## Play it on the web + +Every push to `main` runs the `deploy-pages` job after `export`: it unpacks the Web zip from that run and deploys it to GitHub Pages at . **Actions → Build → Run workflow** on `main` redeploys the same way. The repository's Pages source must be **GitHub Actions** (Settings → Pages) or the deployment is refused. The Web preset leaves out the `*/sources/*` and `*/source/*` generation masters, which no game loads, so the download is roughly half the size of the desktop builds' resources; it still needs a few hundred megabytes of patience on a slow link, and the page shows Godot's progress bar meanwhile. Scores and settings persist in the browser's storage for that site. ## Run it at a booth @@ -90,8 +95,8 @@ python3 tools/build/export_game.py --preset macOS --smoke - **Actions → Build → Run workflow** on a branch creates downloadable Actions artifacts only. Select an existing `v*` tag to build and release that tag. The workflow must be present on the default branch for the manual button to appear. - No custom repository secrets or variables are required. The release job uses the automatic `GITHUB_TOKEN` with `contents: write`; repository/organization policy must allow GitHub Actions and that permission. Signing certificates and Apple notarization credentials are intentionally not configured for these playtest builds. - Blank `export_path` fields are intentional: the build script supplies absolute staging paths. Preset names must remain `macOS`, `Windows Desktop`, `Linux`, and `Web`. -- CI smoke-tests the packaged Linux game. Web packaging checks that HTML, JavaScript, WebAssembly, and PCK files are present, but browser gameplay is not automated. Playtest each platform before promoting a prerelease. +- CI smoke-tests the packaged Linux game. Web packaging checks that HTML, JavaScript, WebAssembly, and PCK files are present; browser gameplay is not automated, so play the Pages build (all six games, including the 3D runner, were checked by hand in a WebGL 2 browser when Pages went live). Playtest each platform before promoting a prerelease. ## What the exports leave out -`tests/`, every `*/dev/*` preview scene and the `capture_*.gd` screenshot scripts. JSON manifests are included explicitly because the game reads them with `FileAccess`. Upgrading Godot means updating `godot.lock.json` (version, SHA-512 values from the release's `SHA512-SUMS.txt`) along with `project.godot`. +`tests/`, every `*/dev/*` preview scene and the `capture_*.gd` screenshot scripts; the Web export also leaves out the `*/sources/*` and `*/source/*` art masters (`tools/build/test_exports.py` checks that filter). JSON manifests are included explicitly because the game reads them with `FileAccess`. Upgrading Godot means updating `godot.lock.json` (version, SHA-512 values from the release's `SHA512-SUMS.txt`) along with `project.godot`. diff --git a/docs/main-menu.md b/docs/main-menu.md index 54592012..646945c2 100644 --- a/docs/main-menu.md +++ b/docs/main-menu.md @@ -23,7 +23,7 @@ The hub shows every game as a tile, three columns by two rows, so a visitor star - **Catalog.** `scenes/main_menu/game_catalog.gd` lists the tiles in grid order: route, family eyebrow (Platformer, Endless Runner, Beat'em Up), one-line tagline, the `preview.gd` indices the tile and the showcase use (the first is the tile's art), and the Hoppy reaction. Adding a game means adding an entry there; the grid, the showcase groups and the focus map follow. - **Tile.** `game_tile.gd` is a Button (it extends `menu_button.gd`, so it grows 5% on focus or hover) with its stage art cover-cropped inside the border, a lower scrim, the family, title and tagline, and an "ENTER / A PLAY" prompt while focused or hovered. The art is the same stage plates and runner stills the background previews use, loaded once through `preview.gd`; no separate tile art exists. -- **Navigation.** Left and right wrap within a row. Up and down step between the rows and, past them, to the utility button in the same column (Settings, Quit Game, Credits; booth mode has no Quit Game), which lead back onto the grid. Tab follows the order tiles, Settings, Quit Game, Credits (`main_menu.gd` `buttons`). Mouse hover focuses nothing but drives the preview and Hoppy; a click launches. +- **Navigation.** Left and right wrap within a row. Up and down step between the rows and, past them, to the utility button in the same column (Settings, Quit Game, Credits; booth mode and the web build have no Quit Game), which lead back onto the grid. Tab follows the order tiles, Settings, Quit Game, Credits (`main_menu.gd` `buttons`). Mouse hover focuses nothing but drives the preview and Hoppy; a click launches. - **Launch and return.** A tile calls `AppRouter.go()` with its gameplay route, so the first entry opens the game's how-to-play card. The hub is the only menu: the per-genre menus of the three-button hub (`platformer_menu`, `runner_menu`, `beatem_menu`) and their routes (`platformer`, `runner`, `beatem_up`) are gone, and every way out of a game lands here. **Main Menu** on a game's pause menu, results, game-over or victory screen, the booth's idle return and its next-player card all call `AppRouter.go("hub")`. The runner's leaderboard moved into its pause menu (see [Pause menu](#pause-menu)). - **Hoppy.** The menu mascot stands top right, beside the title, at two thirds of its old size. The hovered tile's family picks the reaction: platformer jump, 3D runner, brawler jab. diff --git a/hoppys-adventure-arcade/app/app_router.gd b/hoppys-adventure-arcade/app/app_router.gd index abf5c706..eeb409d4 100644 --- a/hoppys-adventure-arcade/app/app_router.gd +++ b/hoppys-adventure-arcade/app/app_router.gd @@ -150,10 +150,14 @@ func go(route: String, reason := "menu") -> bool: veil.mouse_filter = Control.MOUSE_FILTER_IGNORE busy = false return error == OK -## Visitors can't quit a booth from the menu; staff close the window instead (force = true). +## Visitors can't quit a booth from the menu (staff close the window instead, force = true), and a +## browser tab has nothing to quit: the hub shows no Quit Game in either case. +func quit_hidden() -> bool: + return booth or OS.has_feature("web") + ## A forced quit wins even mid-transition: auto_accept_quit is off, so nothing else would close. func quit_game(force := false) -> void: - if booth and not force: + if quit_hidden() and not force: return if busy and not force: return diff --git a/hoppys-adventure-arcade/export_presets.cfg b/hoppys-adventure-arcade/export_presets.cfg index 20d332df..ce0dbc26 100644 --- a/hoppys-adventure-arcade/export_presets.cfg +++ b/hoppys-adventure-arcade/export_presets.cfg @@ -391,7 +391,7 @@ dedicated_server=false custom_features="" export_filter="all_resources" include_filter="*.json" -exclude_filter="tests/*, */dev/*, capture_*.gd, */capture_*.gd" +exclude_filter="tests/*, */dev/*, capture_*.gd, */capture_*.gd, */sources/*, */source/*" export_path="" encrypt_pck=false encrypt_directory=false @@ -407,7 +407,7 @@ vram_texture_compression/for_desktop=true vram_texture_compression/for_mobile=false html/export_icon=true html/custom_html_shell="" -html/head_include="" +html/head_include="" html/canvas_resize_policy=2 html/focus_canvas_on_start=true html/experimental_virtual_keyboard=false diff --git a/hoppys-adventure-arcade/scenes/main_menu/main_menu.gd b/hoppys-adventure-arcade/scenes/main_menu/main_menu.gd index 17200aff..80e4fe5f 100644 --- a/hoppys-adventure-arcade/scenes/main_menu/main_menu.gd +++ b/hoppys-adventure-arcade/scenes/main_menu/main_menu.gd @@ -14,7 +14,7 @@ const BOOTH_QR_POSITION := Vector2(841, 30) @onready var hoppy = $Interface/Hoppy var ui: Control ## The six game tiles in grid order, then Settings, Quit Game and Credits. Booth mode has no Quit -## Game: staff close the window instead. +## Game (staff close the window instead), nor does the web build (the tab is the window). var buttons: Array[Button] = [] var tiles: Array[Button] = [] var utilities: Array[Button] = [] @@ -99,7 +99,7 @@ func _ready() -> void: # Wider than the focus arrow's 25 px reach, so it never sits on the neighbouring button. utility_row.add_theme_constant_override("separation", 28) ui.add_child(utility_row) - for text in ["Settings"] if AppRouter.booth else ["Settings", "Quit Game"]: + for text in ["Settings"] if AppRouter.quit_hidden() else ["Settings", "Quit Game"]: var button := Style.button(text, 46) button.custom_minimum_size.x = 160 utility_row.add_child(button) @@ -208,7 +208,7 @@ func _input(event: InputEvent) -> void: if event.is_action_pressed("ui_cancel"): if modal: _close_modal() - elif not AppRouter.booth: + elif not AppRouter.quit_hidden(): _open_quit(utilities[1]) get_viewport().set_input_as_handled() diff --git a/tools/build/test_exports.py b/tools/build/test_exports.py index 9675736a..07a6f4d3 100644 --- a/tools/build/test_exports.py +++ b/tools/build/test_exports.py @@ -28,6 +28,15 @@ def test_web_archive_contains_every_runtime_file(self): with self.assertRaisesRegex(SystemExit, "index.wasm"): export_game.package(target, stage / "index.html", artifact) + def test_web_preset_leaves_out_art_masters(self): + """The browser download must not carry the */sources/ generation masters no game loads.""" + presets = (export_game.PROJECT / "export_presets.cfg").read_text(encoding="utf-8") + web = presets[presets.index('name="Web"'):] + web = web[:web.index("[preset.", 1)] if "[preset." in web[1:] else web + exclude = next(line for line in web.splitlines() if line.startswith("exclude_filter=")) + for pattern in ("tests/*", "*/dev/*", "*/sources/*", "*/source/*"): + self.assertIn(pattern, exclude) + def test_desktop_companion_files_and_executable_mode(self): target = next(t for t in export_game.TARGETS if t.platform == "linux") with tempfile.TemporaryDirectory() as tmp: