2024-04-04 11:24:26 +11:00
|
|
|
name: Build and Deploy Website
|
|
|
|
|
|
|
|
on:
|
|
|
|
merge_group:
|
|
|
|
push:
|
|
|
|
branches: [master]
|
2024-04-05 04:08:26 +11:00
|
|
|
pull_request:
|
|
|
|
branches: [master]
|
2024-04-04 11:24:26 +11:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2024-04-05 04:09:10 +11:00
|
|
|
name: Build website
|
2024-04-04 11:24:26 +11:00
|
|
|
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
|
2024-05-01 02:55:43 +10:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2024-05-01 02:41:34 +10:00
|
|
|
- name: Checkout latest released version's book
|
|
|
|
run: git restore --source $(git describe --tags --abbrev=0) book
|
2024-04-04 11:24:26 +11:00
|
|
|
- name: Cache
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: |
|
2024-04-09 09:41:28 +10:00
|
|
|
website/agb/node_modules
|
|
|
|
website/agb/.next/cache
|
2024-04-04 11:24:26 +11:00
|
|
|
~/.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
|
2024-04-09 05:55:29 +10:00
|
|
|
uses: peaceiris/actions-mdbook@v2
|
2024-04-04 11:24:26 +11:00
|
|
|
with:
|
|
|
|
mdbook-version: "0.4.13"
|
2024-04-19 04:39:27 +10:00
|
|
|
- name: Setup wasm
|
|
|
|
run: just setup-cargo-wasm
|
2024-04-04 11:24:26 +11:00
|
|
|
- name: Build website
|
2024-04-29 11:00:02 +10:00
|
|
|
run: just podman_command=docker build-site
|
2024-04-04 11:24:26 +11:00
|
|
|
- name: Upload artifact
|
|
|
|
uses: actions/upload-pages-artifact@v3
|
|
|
|
with:
|
|
|
|
path: "website/build"
|
|
|
|
deploy:
|
2024-04-05 04:09:10 +11:00
|
|
|
name: Deploy website
|
2024-04-05 09:39:05 +11:00
|
|
|
if: github.event_name == 'push'
|
2024-04-04 11:24:26 +11:00
|
|
|
# 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
|