This repository is configured to automatically deploy the Discovery app to the same GitHub Pages site as the Harmony project.
The deployment creates the following structure on harmonydata.ac.uk:
- Root (
/): Harmony wrapper website - App folder (
/app): Harmony React application - Search folder (
/search): Discovery Next.js application (this repository)
The .github/workflows/deploy-discovery.yml workflow:
- Triggers: On pushes to
mainbranch, PR merges, or manual dispatch - Builds: Creates a static export of the Discovery app with
/searchbase path - Deploys: Copies the build to the
searchfolder in the harmonydata.github.io repository'sgh-pagesbranch
- Next.js Config:
next.config.jsis configured with conditionalbasePathandassetPrefix - Build Script:
npm run build:github-pagesbuilds withGITHUB_PAGES_DEPLOYMENT=true - Static Export: The app is built as a static site that can run on GitHub Pages
- API Routes: The OG API route is disabled during static builds since server-side functionality isn't available on GitHub Pages
The workflow requires a HARMONY_DEPLOY_TOKEN secret with permissions to push to the harmonydata/harmonydata.github.io repository.
To set this up:
- Go to the harmonydata.github.io repository settings
- Generate a Personal Access Token (classic) with
reposcope - Add this token as a secret named
HARMONY_DEPLOY_TOKENin this repository's settings
The harmonydata.github.io repository should have GitHub Pages configured to serve from the gh-pages branch.
Once deployed, the Discovery app will be accessible at:
https://harmonydata.ac.uk/search/
For local development, use the standard Next.js commands:
npm run dev # Development server (normal basePath)
npm run build # Standard build for Vercel deployment
npm run static # Static export for local testingTo test the GitHub Pages deployment locally:
npm run build:github-pages # Build with /search basePath
npm run serve # Serve the static filesThen navigate to http://localhost:3000/search/ to see how it will look when deployed.
To manually trigger a deployment:
- Go to the Actions tab in this repository
- Select "Deploy Discovery to GitHub Pages"
- Click "Run workflow"
- Build fails with API route errors: The API route exports have been configured to work with static builds
- Base path issues: Make sure all internal links use Next.js Link component or relative paths
- Asset loading: The
assetPrefixensures all assets load from the correct/searchpath - Secret not configured: Ensure
HARMONY_DEPLOY_TOKENis set up with correct permissions
You can test the build locally to ensure it works before deploying:
npm run build:github-pages
# Check that out/ directory contains files with /search paths
head out/index.html | grep "/search"✅ Static build working with /search base path
✅ GitHub Actions workflow configured
HARMONY_DEPLOY_TOKEN secret to be configured