Fix static asset 404s and build-time SITE_NAME
Deploy / deploy (push) Successful in 27s

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/<sha>/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.
This commit is contained in:
Bendik Aagaard Lynghaug
2026-08-04 20:46:00 +02:00
parent 6b1af34d57
commit b0086b2ed9
+9 -1
View File
@@ -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/<sha>/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