80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
name: "Website"
|
|
|
|
on:
|
|
workflow_dispatch: {}
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- website/**
|
|
pull_request:
|
|
paths:
|
|
- website/**
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
INDEX_HTML_HEAD_INCLUSION: <script defer data-domain="graphite.art" data-api="/visit/event" src="/visit/script.hash.js"></script>
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
deployments: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: 📥 Clone repository
|
|
uses: actions/checkout@v6
|
|
|
|
- name: 🟢 Install Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: .nvmrc
|
|
|
|
- name: 🕸 Install Zola
|
|
uses: taiki-e/install-action@v2
|
|
with:
|
|
tool: zola@0.22.0
|
|
|
|
- name: 🔍 Check if `website/other` directory changed
|
|
uses: dorny/paths-filter@v3
|
|
id: changes
|
|
with:
|
|
filters: |
|
|
website-other:
|
|
- "website/other/**"
|
|
|
|
- name: ✂ Replace template in <head> of index.html
|
|
run: |
|
|
# Remove the INDEX_HTML_HEAD_INCLUSION environment variable for build links (not master deploys)
|
|
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_INCLUSION=""
|
|
|
|
- name: 🦀 Produce auto-generated code docs data
|
|
run: |
|
|
rustup update stable
|
|
cargo run -p crate-hierarchy-viz -- website/generated
|
|
cargo run -p editor-message-tree -- website/generated
|
|
|
|
- name: 🔧 Install website npm dependencies
|
|
run: |
|
|
cd website
|
|
npm ci
|
|
|
|
- name: 📃 Generate node catalog documentation
|
|
run: cargo run -p node-docs -- website/content/learn/node-catalog
|
|
|
|
- name: 🌐 Build Graphite website with Zola
|
|
env:
|
|
MODE: prod
|
|
run: |
|
|
cd website
|
|
npm run check
|
|
zola --config config.toml build --minify
|
|
|
|
- name: 📤 Publish to Cloudflare Pages
|
|
continue-on-error: true
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
run: npx wrangler@3 pages deploy "website/public" --project-name="graphite-website" --commit-dirty=true
|