Update deploy.yaml #3
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
# Extracted from https://github.com/JulianCataldo/gh-actions/tree/main | |
name: Scorched Report — Deploy to Demo to GitHub Pages | |
on: | |
push: | |
branches: ['main'] | |
workflow_dispatch: | |
env: | |
CI: true | |
FORCE_COLOR: true | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
deploy: | |
name: Deploy demo | |
runs-on: ubuntu-20.04 | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
pages: write | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
# ———————————————————————————————————————————————————————————————————————— | |
- name: Setup Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
# ———————————————————————————————————————————————————————————————————————— | |
- name: Setup PNPM 7 | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 7.18.1 | |
run_install: false | |
- name: Get PNPM store directory | |
id: pnpm-cache | |
run: | | |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
- uses: actions/cache@v3 | |
name: Setup PNPM cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
# ———————————————————————————————————————————————————————————————————————— | |
- name: Install Node dependencies | |
# `production` to exclude dev. dependencies | |
run: NODE_ENV=production pnpm install | |
- name: Build demo website (dist) | |
run: 'NODE_ENV=production pnpm run build' | |
# ———————————————————————————————————————————————————————————————————————— | |
# NOTE: Could be swapped with Vercel, Netlify… | |
- name: Upload artifact — Demo (dist) | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./dist | |
- name: Deploy to GitHub Pages — Demo (dist) | |
id: deployment | |
uses: actions/deploy-pages@v1 |