Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
run: npm run build:website
env:
SEARCH_URL: ${{ secrets.SEARCH_URL }}
BASE_HREF: /moaw/
- name: Setup GitHub Pages
uses: actions/configure-pages@v4
- name: Upload artifact
Expand Down
3 changes: 3 additions & 0 deletions packages/website/scripts/update-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ fi
dist_folder="dist/website"
version="sha.$(git rev-parse --short HEAD)"
ai_search_url="${AI_SEARCH_URL:-}"
base_href="${BASE_HREF:-/moaw/}"

perl -i -pe "s/__VERSION__/$version/g" $dist_folder/main.*.js
perl -i -pe "s/__AI_SEARCH_URL__/$ai_search_url/g" $dist_folder/main.*.js
perl -i -pe "s|__BASE_HREF__|$base_href|g" $dist_folder/index.html $dist_folder/404.html

echo Version: $version
echo Base href: $base_href
4 changes: 3 additions & 1 deletion packages/website/src/public/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<!-- Workaround for GitHub Pages not supporting SPA routing -->
<script>
sessionStorage.redirect = location.href;
const url = window.location.hostname.includes('.github.io') ? '/moaw/' : '/';
const hostname = window.location.hostname;
const isGitHubPagesHost = hostname === 'github.io' || hostname.endsWith('.github.io');
const url = isGitHubPagesHost ? '__BASE_HREF__' : '/';
window.location.replace(url);
</script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion packages/website/src/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
if (window.location.hostname.includes('.github.io')) {
window.document.head.getElementsByTagName('base')[0].href = '/moaw/';
window.document.head.getElementsByTagName('base')[0].href = '__BASE_HREF__';
}
</script>
<link rel="icon" type="image/png" href="favicon.png">
Expand Down
Loading