Skip to content

build/setup ssg

build/setup ssg #50

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: ⚙️ Lint & Build
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches:
- main
- develop
- "releases/**"
tags:
- "**"
pull_request:
branches:
- main
- develop
- "releases/**"
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
init:
name: 🏗 Init
runs-on: ubuntu-latest
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v3
- name: 🎒 Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: 📥 Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false
- name: 🔎 Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: 💾 Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 📦 Install Dependencies
run: pnpm install
lint:
name: 🧪 Lint
runs-on: ubuntu-latest
needs:
- init
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v3
- name: 🎒 Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: 📥 Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false
- name: 🔎 Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: 💾 Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 📦 Install Dependencies
run: pnpm install
- name: 🧪 Run Linter
run: pnpm run lint
build:
name: 🔧 Build
runs-on: ubuntu-latest
needs:
- lint
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🎒 Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: 📥 Install pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false
- name: 🔎 Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: 💾 Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 📦 Install Dependencies
run: pnpm install
- name: 🔧 Run Build
run: pnpm run build:prod
- name: 🚀 Publish to GitHub Pages
if: ${{ contains(github.ref, 'refs/heads/main') }}
uses: JamesIves/github-pages-deploy-action@4.1.0
with:
branch: gh-pages # The branch the action should deploy to.
folder: dist/ # The folder the action should deploy.