Skip to content

Improve workflow

Improve workflow #8

Workflow file for this run

name: Deploy to Pages
on:
push:
branches: ['main']
paths-ignore: ['**.md', '.github/**']
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
build:
environment:
name: github-pages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: yarn
- name: Configure for Pages
uses: actions/configure-pages@v4
with:
static_site_generator: next
- name: Restore cache
uses: actions/cache@v4
with:
path: .next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}-
- name: Install dependencies
run: yarn install
- name: Run linter
run: yarn lint
- name: Run formatter
run: yarn format:check
- name: Build
run: yarn build
env:
NEXT_PUBLIC_URL: ${{ vars.NEXT_PUBLIC_URL }}
BASE_PATH: ${{ vars.BASE_PATH }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./out
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to Pages
id: deployment
uses: actions/deploy-pages@v4