Update nextjs.yml #12
This file contains 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: Run Next.js Build | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18.17.0" # Adjust to match your project's requirements | |
- name: Install dependencies | |
run: npm install # Or yarn install, depending on your package manager | |
- name: Build with Next.js | |
run: npm run build # Or yarn build, depending on your package manager | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nextjs-build | |
path: ./out | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |