Skip to content

Commit

Permalink
ci: add automatic deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
kentbull committed Aug 26, 2024
1 parent ca25ef3 commit 95a0e6a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/deploy-master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Update GitHub Pages

on:
# Trigger the workflow on push to master/main branch
push:
branches:
- master
- main
# Allows manual triggering from the Actions tab
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' # Specify the Node.js version you use

- 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 "[email protected]"
git config --local user.name "GitHub Actions"
git fetch origin gh-pages
git switch gh-pages
- 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
File renamed without changes.

0 comments on commit 95a0e6a

Please sign in to comment.