97 lines
2.4 KiB
YAML
97 lines
2.4 KiB
YAML
name: Deploy Next.js site to Pages
|
|
|
|
on:
|
|
push:
|
|
branches: ["master"]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
pages: write
|
|
id-token: write
|
|
deployments: write
|
|
|
|
concurrency:
|
|
group: "pages"
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
|
|
# - name: Install pnpm
|
|
# run: npm install -g pnpm
|
|
|
|
|
|
|
|
- name: Cache Dependencies
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-modules-
|
|
|
|
- name: Cache Build Output
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
.next/cache
|
|
key: ${{ runner.os }}-nextjs-build-output-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-nextjs-build-output-
|
|
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: nextjs-build
|
|
path: .next/
|
|
- 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
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|
|
|
|
# deploy:
|
|
# needs: build
|
|
# runs-on: ubuntu-latest
|
|
# steps:
|
|
# - name: Download Artifacts
|
|
# uses: actions/download-artifact@v3
|
|
# with:
|
|
# name: nextjs-build
|
|
# path: .
|
|
|
|
# - name: Deploy to GitHub Pages
|
|
# uses: peaceiris/actions-gh-pages@v3
|
|
# with:
|
|
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
# publish_dir: ./next/.next
|
|
# publish_branch: gh-pages # Change this to master if using the master branch for GitHub Pages
|
|
# allow_empty_commit: false
|
|
# keep_files: false
|
|
# force_orphan: false
|
|
# enable_jekyll: false
|
|
# disable_nojekyll: false
|
|
# exclude_assets: .github
|