From 27e35948f0d008cd36fb674a7e7e54517b39b7ef Mon Sep 17 00:00:00 2001 From: Ashish Nagar Date: Fri, 31 Jul 2026 12:53:38 -0400 Subject: [PATCH] Publish the app to GitHub Pages Builds on every push to main and deploys the result, behind the same gates CI runs: a failing typecheck, test or build never reaches the live page. Asset URLs are now relative (`base: './'`) rather than absolute. A project site is served from /blackhole-sim/, and the default absolute paths would ask for /assets/... at the domain root and 404. Relative paths work both from a subpath and from a domain root, so this does not tie the build to one host. Deployments queue rather than cancel, so a push that lands mid-deploy still ends up published. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/deploy-pages.yml | 47 ++++++++++++++++++++++++++++++ README.md | 4 +++ vite.config.ts | 3 ++ 3 files changed, 54 insertions(+) create mode 100644 .github/workflows/deploy-pages.yml diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..ee44497 --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,47 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: [main] + workflow_dispatch: + +# Let the deployment write to Pages, and read the repo to build it. +permissions: + contents: read + pages: write + id-token: write + +# One deployment at a time. Queue rather than cancel, so a push that lands +# mid-deploy still ends up published. +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - run: npm ci + # The same gates CI runs. A broken build should not reach the live page. + - run: npm run typecheck + - run: npm test + - run: npm run build + - uses: actions/configure-pages@v5 + - uses: actions/upload-pages-artifact@v3 + with: + path: dist + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index aa16228..0fcd7f2 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,10 @@ [![Tests](https://img.shields.io/badge/tests-51%20passing-brightgreen)](src/sim/__tests__) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) +### [Open it in your browser](https://algometrix.github.io/blackhole-sim/) + +No install, no account. It needs WebGL2, which every current desktop browser has. + An interactive black hole visualizer that ray-traces **real Schwarzschild photon geodesics on the GPU**, per pixel, every frame. It renders the event horizon shadow, the photon ring, a Doppler-beamed accretion disc bent over and under the hole (the *Interstellar* look), and a gravitationally lensed starfield. You can launch photons and watch their true paths, drop a planet or star and watch it be tidally shredded, and place a second black hole to watch a gravitational-wave inspiral end in a merger, complete with a LIGO-style audio chirp. Everything runs in the browser. No backend, no textures, no libraries beyond Three.js: the stars, disc, physics, and sound are all procedural. diff --git a/vite.config.ts b/vite.config.ts index 6398b21..27dbfeb 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,5 +3,8 @@ import glsl from 'vite-plugin-glsl'; export default defineConfig({ plugins: [glsl()], + // Relative asset URLs, so the same build works from a domain root and from + // the /blackhole-sim/ subpath GitHub Pages serves a project site at. + base: './', build: { target: 'es2022' }, });