From b0086b2ed9d5391c40110c938bcd45c7f63d7e01 Mon Sep 17 00:00:00 2001 From: Bendik Aagaard Lynghaug Date: Tue, 4 Aug 2026 20:46:00 +0200 Subject: [PATCH] Fix static asset 404s and build-time SITE_NAME Two runtime gaps found via hwatu after the first successful deploy: - /pkg/*.{js,wasm,css} 404'd because the running binary looked for target/site (Cargo.toml's site-root, a build-time path) but the deploy step copies the bundle to releases//site with no target/ prefix - LEPTOS_SITE_ROOT=site in the runtime env corrects it. - SITE_NAME is read via option_env! (compile-time), so writing it only into the runtime env file never reached the binary - the wordmark stayed "portal". Now exported for the Build step too. Verified live: applied both fixes directly to the running deployment first (no CI round-trip), confirmed via hwatu (no console errors, hero renders, all three alternatives' forms present) before folding them back into the workflow. --- .gitea/workflows/deploy.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 4f21323..9bdb898 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -41,8 +41,11 @@ jobs: steps: - uses: actions/checkout@v4 + # SITE_NAME is read via option_env! (src/app.rs) - compile-time, + # not a runtime env var - so it has to be set here, not just in + # the "Write service env" step below. - name: Build - run: cargo leptos build --release + run: SITE_NAME=${{ vars.PORTAL_SITE_NAME }} cargo leptos build --release - name: Ship release run: | @@ -72,6 +75,11 @@ jobs: CONTENT_BRANCH=main SITE_NAME=${{ vars.PORTAL_SITE_NAME }} LEPTOS_SITE_ADDR=0.0.0.0:3010 + # Cargo.toml's site-root ("target/site") is a build-time path; + # the deploy layout copies the bundle to releases//site + # (no target/ prefix) - override so the running binary looks + # in the right place for /pkg/*. + LEPTOS_SITE_ROOT=site EOF # No sudo: the runner's own unit sets NoNewPrivileges=yes, which