Skip to content

Commit eb85a5e

Browse files
committed
Add GitHub Pages SPA fallback
1 parent 737f312 commit eb85a5e

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ jobs:
5151
- name: Copy logos
5252
run: cp -rf logos explorer/dist/
5353

54+
- name: Create SPA 404 fallback
55+
run: cp explorer/dist/index.html explorer/dist/404.html
56+
5457
- name: Upload Pages artifact
5558
uses: actions/upload-pages-artifact@v3
5659
with:

.github/workflows/pr-review.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ jobs:
5454
run: yarn build
5555
env:
5656
NODE_OPTIONS: --max_old_space_size=4096
57+
58+
- name: Verify SPA 404 fallback
59+
run: cp explorer/dist/index.html explorer/dist/404.html && test -s explorer/dist/404.html

docs/github-automation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ In repository settings:
1212

1313
The `Deploy to GitHub Pages` workflow builds the `explorer` submodule, copies this repository's chain configs and logos into the build output, uploads `explorer/dist`, and deploys it through GitHub Pages.
1414

15+
The workflow also copies `index.html` to `404.html`. GitHub Pages serves `404.html` for missing paths, so direct visits to Vue Router history-mode URLs can fall back to the SPA entry and be handled client-side. This approximates an nginx `try_files $uri /index.html` setup, although the HTTP status for those fallback responses is still 404 because GitHub Pages is static hosting.
16+
1517
## Pull Request Review
1618

1719
The `Pull Request Review` workflow runs on pull requests that change chain configs, logos, workflows, or repository metadata. It validates chain configs and verifies that the explorer still builds.

0 commit comments

Comments
 (0)