Generate Docs into gh-pages #20
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
name: Generating Docs | |
run-name: Generate Docs into gh-pages | |
permissions: | |
contents: write | |
on: # rebuild gh-pages when doc change on master | |
push: | |
branches: | |
- master | |
paths: | |
- 'src/**' | |
- '!src/lib/**' | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: false | |
jobs: | |
build-and-deploy: | |
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession. | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
# Checkout | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# The whole Node.js and pnpm installation and caching | |
# Based on https://github.com/pnpm/action-setup/tree/6e1964dde3397a825e79e4607ad57f3f7ca2c7cb#use-cache-to-reduce-installation-time | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 9 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
run: | | |
echo "pnpm_cache_dir=$(pnpm store path)" >> ${GITHUB_OUTPUT} | |
- uses: actions/cache@v4 | |
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 dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Svelte Sync | |
run: npx svelte-kit sync | |
# Build Frontend | |
- name: Build Frontend | |
run: pnpm run build | |
env: | |
BASE_PATH: /${{ github.event.repository.name }} | |
# Deploy Docs | |
- name: Deploy Docs 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: docs | |
target-folder: / |