Skip to content

CI: build and deploy the web frontend when it changes#3

Merged
richardhapb merged 1 commit into
mainfrom
ci/web-deploy
Jul 21, 2026
Merged

CI: build and deploy the web frontend when it changes#3
richardhapb merged 1 commit into
mainfrom
ci/web-deploy

Conversation

@richardhapb

Copy link
Copy Markdown
Owner

What

finitum.app's frontend was deployed by hand (nginx serving a static build) and had silently drifted from main -- CI only ever shipped the API image. This automates it:

  • changes job: dorny/paths-filter detects web/** changes (the workflow file itself is included, so pipeline changes force one republish to stay in sync).
  • build-web job (only when the frontend changed): Bun build with VITE_API_URL from the new WEB_API_URL repo variable (already set; it's public info -- baked into the shipped bundle), packed as an artifact.
  • deploy job: downloads the artifact, scp's it (no sudo) to a fixed path in the deploy user's home, then calls sudo finitum-deploy --web after the backend deploy. always() + explicit result checks keep backend deploys working when build-web is skipped, while still blocking on a failed web build.
  • The server-side finitum-deploy script gained the --web mode (already installed on the VPS): reads the tarball only from its fixed path (no attacker-chosen paths across the sudo boundary), refuses archives without index.html, stages beside the web root and swaps atomically, keeping the previous build at finitum.bak for one-mv rollback.
  • docs/deployment.md updated.

Verification

  • The exact --web path was exercised on the VPS with a real build: published successfully, and finitum.app now serves the forwarding/OSS frontend (zero "Gmail Integration" occurrences; /guide 200; /api/banks healthy).
  • Guard tested: --web with no tarball staged exits 2 with a clear error.
  • Workflow YAML parses; first fully automated web deploy fires on this PR's merge (the workflow file is in the web filter).

🤖 Generated with Claude Code

The static frontend was previously deployed by hand and had drifted
from main. Now a build-web job (gated by a paths filter on web/**)
builds with Bun, ships the tarball to the deploy user's home via scp,
and finitum-deploy --web publishes it: fixed tarball path only,
index.html sanity check, atomic swap, previous build kept as backup.
@richardhapb
richardhapb merged commit 0fb033e into main Jul 21, 2026
6 checks passed
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