Skip to content

7 enable automated publishing to gh pages (#8) #9

7 enable automated publishing to gh pages (#8)

7 enable automated publishing to gh pages (#8) #9

name: Deploy VitePress site to Pages
# Based on https://vitepress.dev/guide/deploy#github-pages
# Enables automatic publishing of the website to GitHub Pages from main branch.
on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab for debugging purposes
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false
jobs:
# Build job
build:
name: Build
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
# Check out the branch
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
with:
fetch-depth: 0
# Fix "Corepack must currently be enabled by running corepack enable in your terminal."
- name: Enable Corepack
run: corepack enable
# Setup Node.js with yarn support
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: 'lts/*' # Ensures the latest LTS version is used
cache: yarn # npm / pnpm / yarn
# Configure GitHub Pages
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b
# Install javascript dependencies with yarn
- name: Install dependencies
run: yarn install # or pnpm install / yarn install / bun install
# Build the website
- name: Build with VitePress
run: yarn run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
# Upload the artefact to GitHub Pages
- name: Upload artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b
with:
path: web/.vitepress/dist
# Deployment job
deploy:
# Execute deployment only from master branch
if: github.ref == 'refs/heads/main'
name: Deploy
runs-on: ubuntu-latest
# Add a dependency to the build job
needs: build
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e