implement github pages & action

This commit is contained in:
Justin Lee 2024-11-06 15:16:36 -08:00
parent 994732e2e0
commit 6cd67d0cbd
2 changed files with 87 additions and 0 deletions

56
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,56 @@
name: Deploy to GitHub Pages
defaults:
run:
shell: bash
working-directory: ./scripts
on:
push:
branches:
- gh-pages
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build
- name: Upload Build Artifact
uses: actions/upload-pages-artifact@v3
with:
path: build
deploy:
name: Deploy to GitHub Pages
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

31
.github/workflows/test-deploy.yml vendored Normal file
View file

@ -0,0 +1,31 @@
name: Test deployment
defaults:
run:
shell: bash
working-directory: ./scripts
on:
pull_request:
branches:
- gh-pages
# Review gh actions docs if you want to further define triggers, paths, etc
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Test build website
run: yarn build