This document outlines the deployment process for CodeStorm Hub using GitHub Pages with automated GitHub Actions workflow.
CodeStorm Hub is deployed using GitHub Pages with a Next.js static export. The deployment process is fully automated through GitHub Actions, which builds and deploys the site whenever changes are pushed to the main branch.
- Framework: Next.js 15 with static export (
output: 'export') - Deployment Platform: GitHub Pages
- Automation: GitHub Actions workflow
- Branch:
main(production deployment) - Build Output: Static HTML/CSS/JS files in
/outdirectory
The application is configured for static export with GitHub Pages optimizations:
const nextConfig: NextConfig = {
output: 'export',
trailingSlash: true,
images: {
unoptimized: true, // Required for GitHub Pages
remotePatterns: [new URL("https://github.com/CodeStorm-Hub.png")],
},
// GitHub Pages specific paths
basePath: process.env.NODE_ENV === 'production' ? '/CodeStorm-Hub.github.io' : '',
assetPrefix: process.env.NODE_ENV === 'production' ? '/CodeStorm-Hub.github.io/' : '',
};Automated deployment workflow that:
- Triggers on pushes to
mainbranch and pull requests - Can be manually triggered via workflow_dispatch
- Builds the Next.js application as static files using
npm run build:github-pages - Creates
.nojekyllfile to disable Jekyll processing - Deploys to GitHub Pages using official GitHub Pages action
.nojekyll: Automatically created during build to prevent GitHub from processing the site with Jekyll (critical for_nextdirectory assets)404.html: Custom 404 page (automatically generated by Next.js)- Asset files: All CSS/JS files in
_next/static/directory with correct basePath prefixes
- Trigger: Push changes to the
mainbranch - Build: GitHub Actions runs
npm run build:github-pages - Export: Next.js generates static files in
/outdirectory - Deploy: Files are deployed to GitHub Pages
- Live: Site is available at
https://codestorm-hub.github.io/CodeStorm-Hub.github.io/
You can manually trigger deployment:
- Go to the repository's Actions tab
- Select "Deploy to GitHub Pages" workflow
- Click "Run workflow" on the main branch
To test the GitHub Pages build locally:
# Install dependencies
npm install
# Build for GitHub Pages
npm run build:github-pages
# Serve the static files (optional)
npx serve outEnsure the following GitHub repository settings are configured:
- Navigate to Settings → Pages
- Source: Deploy from a branch
- Branch: Select
gh-pages(created automatically by the workflow) - Folder:
/ (root)
- Navigate to Settings → Actions → General
- Ensure "Allow all actions and reusable workflows" is selected
- Under "Workflow permissions", select "Read and write permissions"
-
Build Fails
- Check the Actions tab for error logs
- Ensure all dependencies are properly listed in
package.json - Verify TypeScript compilation passes locally
-
Assets Not Loading
- Confirm
basePathandassetPrefixare correctly configured - Check that images use the Next.js
Imagecomponent - Verify links use Next.js
Linkcomponent
- Confirm
-
404 Errors on Page Refresh
- This is expected behavior for client-side routing in GitHub Pages
- The custom 404.html handles fallback routing
-
Workflow Permissions Error
- Ensure repository has proper Actions permissions
- Check that GITHUB_TOKEN has necessary permissions
After deployment, verify:
- Site loads at the GitHub Pages URL
- Navigation works correctly
- Images and assets load properly
- All pages are accessible
- Responsive design works across devices
- Dark/light mode toggle functions
- No console errors in browser developer tools
The GitHub Pages deployment includes several optimizations:
- Static Generation: All pages are pre-generated at build time
- Asset Optimization: Images and assets are optimized for web delivery
- Bundle Splitting: JavaScript is split into optimized chunks
- CSS Optimization: Tailwind CSS is purged of unused styles
- Caching: Static assets leverage browser caching
Monitor deployment status:
- Actions Tab: View build and deployment logs
- Pages Settings: Check deployment status and URL
- Repository Insights: Monitor site traffic and performance
Regular maintenance tasks:
- Monitor GitHub Actions workflow runs
- Update dependencies periodically
- Review and optimize Core Web Vitals
- Test deployment after major changes
- Keep documentation updated
To use a custom domain:
- Add a
CNAMEfile to the repository root - Configure DNS records with your domain provider
- Update the domain in repository Pages settings
- Update
basePathandassetPrefixinnext.config.ts
- All builds run in isolated GitHub Actions environments
- No sensitive data is exposed in client-side code
- Dependencies are automatically scanned for vulnerabilities
- HTTPS is enforced by default on GitHub Pages
For questions or issues with deployment, please refer to the GitHub Pages documentation or open an issue in this repository.