Website #734
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Website" | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- website/** | |
pull_request: | |
paths: | |
- website/** | |
workflow_dispatch: {} | |
env: | |
CARGO_TERM_COLOR: always | |
INDEX_HTML_HEAD_INCLUSION: <script defer data-domain="graphite.rs" 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 and checkout repository | |
uses: actions/checkout@v3 | |
- name: 🕸 Install Zola | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: [email protected] | |
- 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: 💿 Obtain cache of auto-generated code docs artifacts | |
id: cache-website-code-docs | |
uses: actions/cache/restore@v3 | |
with: | |
path: artifacts | |
key: website-code-docs | |
- name: 📁 Fallback in case auto-generated code docs artifacts weren't cached | |
if: steps.cache-website-code-docs.outputs.cache-hit != 'true' | |
run: | | |
echo "🦀 Initial system version of Rust:" | |
rustc --version | |
rustup update stable | |
echo "🦀 Latest updated version of Rust:" | |
rustc --version | |
cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree | |
mkdir artifacts | |
mv hierarchical_message_system_tree.txt artifacts/hierarchical_message_system_tree.txt | |
- name: 🚚 Move `artifacts` contents to the project root | |
run: | | |
mv artifacts/* . | |
- name: 🔧 Build auto-generated code docs artifacts into HTML | |
run: | | |
cd website | |
npm run generate-editor-structure | |
- name: 🌐 Build Graphite website with Zola | |
env: | |
MODE: prod | |
run: | | |
cd website | |
npm run install-fonts | |
zola --config config.toml build --minify | |
- name: 📤 Publish to Cloudflare Pages | |
id: cloudflare | |
uses: cloudflare/pages-action@1 | |
continue-on-error: true | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
projectName: graphite-website | |
directory: website/public |