build/setup ssg #50
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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/[email protected] | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: dist/ # The folder the action should deploy. |