Skip to content

Create nextjs.yml

Create nextjs.yml #6

Workflow file for this run

name: "Deploy Static Files to GH-pages"
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checking Out"
uses: actions/[email protected]
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: |
echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: "Caching yarn"
uses: actions/[email protected]
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: "Caching build"
uses: actions/[email protected]
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Setting Up Node.js
uses: actions/[email protected]
with:
node-version: "21"
cache: "yarn"
- name: Installing dependencies
run: yarn install
- name: Generating Static Files
run: yarn build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: github-pages
path: kinact-package
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: github-pages
path: kinact-package
- name: Deploy to GitHub Pages
uses: actions/[email protected]