-
Notifications
You must be signed in to change notification settings - Fork 1
Rewrite GitHub Pages deployment with official Next.js workflow and modern best practices #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite GitHub Pages deployment with official Next.js workflow and modern best practices #21
Conversation
Co-authored-by: rezwana-karim <[email protected]>
Co-authored-by: rezwana-karim <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR completely rewrites the GitHub Pages deployment configuration to use GitHub's official Next.js workflow template and adopts modern deployment best practices.
- Replaces custom deployment workflows with GitHub's official Next.js template
- Simplifies Next.js configuration by removing conditional logic and redundant settings
- Adds comprehensive CI testing across multiple Node.js versions
Reviewed Changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
package.json |
Removes custom build:github-pages script, simplifying build process |
next.config.ts |
Streamlines configuration by removing conditional GitHub Pages logic and using static export settings |
docs/github-pages-deployment.md |
Complete rewrite with updated deployment instructions using official workflows |
.github/workflows/nextjs.yml |
New official Next.js deployment workflow with automatic package manager detection |
.github/workflows/deploy.yml |
Removes old custom deployment workflow |
.github/workflows/copilot-validation.yml |
Removes old validation workflow |
.github/workflows/ci.yml |
New comprehensive CI workflow testing multiple Node.js versions |
| hostname: "github.com", | ||
| pathname: "/CodeStorm-Hub/**", |
Copilot
AI
Sep 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The remote pattern configuration is incorrect. GitHub profile images are served from avatars.githubusercontent.com, not github.com. The pathname should match the actual GitHub avatar URL structure.
| hostname: "github.com", | |
| pathname: "/CodeStorm-Hub/**", | |
| hostname: "avatars.githubusercontent.com", | |
| pathname: "/u/**", |
| path: | | ||
| .next/cache | ||
| # Generate a new cache whenever packages or source files change. | ||
| key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} |
Copilot
AI
Sep 29, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cache key pattern **.[jt]s and **.[jt]sx will not match TypeScript and JSX files correctly. The pattern should be **/*.{js,jsx,ts,tsx} to properly match file extensions.
| key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
| key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**/*.{js,jsx,ts,tsx}') }} |
This PR completely rewrites the GitHub Pages deployment configuration to use GitHub's official Next.js workflow template and follows current best practices for static site deployment.
Problem Statement
The existing deployment workflow had several issues:
next.config.tswith redundant settingsSolution
🔄 Workflow Modernization
deploy.ymlandcopilot-validation.ymlworkflows.github/workflows/nextjs.ymlusing GitHub's official Next.js Pages template.github/workflows/ci.ymlfor comprehensive continuous integration testing⚙️ Configuration Simplification
next.config.tsto essential static export settings onlypackage.jsonto remove custombuild:github-pagesscript.gitignoreto properly exclude build artifacts (/out/directory)📚 Documentation Update
docs/github-pages-deployment.mdwith current best practicesKey Benefits
🚀 Performance & Reliability
🔒 Security & Standards
🛠️ Developer Experience
Technical Details
The new workflow:
actions/configure-pages@v5with Next.js-specific optimizations/outdirectory (properly gitignored)actions/deploy-pages@v4with proper artifact handlingRepository Setup Required
After merging, ensure repository settings are configured:
Validation
/outdirectory structureThis modernization brings the deployment configuration in line with current GitHub Pages and Next.js best practices, ensuring reliable, performant, and maintainable deployments.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.