Deployment #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Setup Pages | |
| id: setup_pages | |
| uses: actions/configure-pages@v5 | |
| - name: Restore Next.js build cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .next/cache | |
| key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx', '**/*.ts', '**/*.tsx') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
| - name: Build (GitHub Pages) | |
| # Ensure your build script outputs static assets to ./out | |
| # If needed, set output: 'export' in next.config.js | |
| run: npm run build:github-pages | |
| env: | |
| PAGES_BASE_PATH: ${{ steps.setup_pages.outputs.base_path }} | |
| - name: Add .nojekyll file | |
| run: | | |
| echo "Creating .nojekyll file to disable Jekyll processing" | |
| touch out/.nojekyll | |
| echo "Verifying .nojekyll file was created:" | |
| ls -la out/.nojekyll | |
| - name: Debug build output | |
| run: | | |
| echo "Build output structure:" | |
| ls -la out/ | |
| echo "Checking _next directory (if present):" | |
| ls -la out/_next/ || echo "_next directory not found (ensure static export)." | |
| if [ -d out/_next/static/chunks ]; then | |
| echo "Checking static chunks:" | |
| ls -la out/_next/static/chunks/ | head -20 | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./out | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |