Skip to content

Merge branch 'blogUpdate' #10

Merge branch 'blogUpdate'

Merge branch 'blogUpdate' #10

name: Build and push to gh-pages
on:
push:
branches:
- master
- main
workflow_dispatch:
jobs:
update-gh-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: '0' # Fetch all history so we can push to gh-pages
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build Docusaurus site
run: yarn build
- name: Checkout gh-pages branch
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git fetch origin gh-pages
git switch gh-pages
git rebase master
- name: Remove old site directory
run: rm -rf ./site
- name: Move build to site directory
run: mv ./build ./site
- name: Commit changes
run: |
TIMESTAMP=$(date +"%Y-%m-%d %H:%M")
git add site/*
git commit -m "Update site with new build - $TIMESTAMP"
- name: Push changes to gh-pages branch
run: git push origin gh-pages --force