Skip to content

Merge pull request #30 from calimero-network/fix--nextjs-build-workflow #1

Merge pull request #30 from calimero-network/fix--nextjs-build-workflow

Merge pull request #30 from calimero-network/fix--nextjs-build-workflow #1

Workflow file for this run

name: Deploy Next.js site to Pages
on:
push:
branches: ["master"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pnpm
run: npm install -g pnpm
- name: Set package manager
id: set-package-manager
run: |
echo "manager=pnpm" >> $GITHUB_ENV
echo "command=install" >> $GITHUB_ENV
echo "runner=pnpm" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: ${{ steps.set-package-manager.outputs.manager }}
- name: Setup Pages
uses: actions/configure-pages@v5
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next
- name: Restore cache
uses: actions/cache@v4
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-nextjs-
- name: Install dependencies
run: ${{ steps.set-package-manager.outputs.manager }} ${{ steps.set-package-manager.outputs.command }}
- name: Build with Next.js
run: ${{ steps.set-package-manager.outputs.runner }} run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
name: build
path: .next
deploy:
environment:
name: github-pages
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .next