add website build action

This commit is contained in:
Corwin 2024-04-04 01:24:26 +01:00
parent 366b135b0f
commit 36a749160c
No known key found for this signature in database

56
.github/workflows/build-site.yml vendored Normal file
View file

@ -0,0 +1,56 @@
name: Build and Deploy Website
on:
merge_group:
push:
branches: [master]
jobs:
build:
name: Just CI
runs-on: ubuntu-22.04
steps:
- name: Set CARGO_TARGET_DIR
run: echo "CARGO_TARGET_DIR=$HOME/target" >> $GITHUB_ENV
- name: Install build tools
run: sudo apt-get update && sudo apt-get install build-essential libelf-dev zip -y
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}--npm--${{ hashFiles('**/package-lock.json') }}
- uses: extractions/setup-just@v2
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "0.4.13"
- name: Build website
run: just build-site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "website/build"
deploy:
# Add a dependency to the build job
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 }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4