This repository was archived by the owner on Sep 24, 2025. It is now read-only.
  
  
  
  
Merge pull request #10 from bitesinbyte/dependabot/npm_and_yarn/eslin… #30
  
    
      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 Next.js site to Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| # Build job | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@v2 # v2.8.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@v4 # v4.1.7 | |
| - name: Detect package manager | |
| id: detect-package-manager | |
| run: | | |
| echo "manager=npm" >> $GITHUB_OUTPUT | |
| echo "command=ci" >> $GITHUB_OUTPUT | |
| echo "runner=npx --no-install" >> $GITHUB_OUTPUT | |
| exit 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 # v4.0.2 | |
| with: | |
| node-version: "20" | |
| cache: ${{ steps.detect-package-manager.outputs.manager }} | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 # v5.0.0 | |
| with: | |
| static_site_generator: next | |
| - name: Restore cache | |
| uses: actions/cache@v4 # v4.0.0 | |
| with: | |
| 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') }} | |
| # If source files changed but packages didn't, rebuild from a prior cache. | |
| restore-keys: | | |
| ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- | |
| - name: Install dependencies | |
| run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }} | |
| - name: Build with Next.js | |
| run: ${{ steps.detect-package-manager.outputs.runner }} next build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 # v3.0.1 | |
| with: | |
| path: ./out | |
| # Deployment job | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@v2 # v2.8.1 | |
| with: | |
| egress-policy: audit | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 # v4.0.4 |