name: "Website" on: workflow_dispatch: {} push: branches: - master paths: - website/** pull_request: paths: - website/** env: CARGO_TERM_COLOR: always INDEX_HTML_HEAD_INCLUSION: jobs: build: runs-on: ubuntu-latest permissions: contents: read deployments: write pull-requests: write steps: - name: 📥 Clone repository uses: actions/checkout@v4 - name: 🟢 Install Node.js uses: actions/setup-node@v4 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 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@v4 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 cd tools/editor-message-tree cargo run cd ../.. mkdir artifacts mv website/generated/hierarchical_message_system_tree.txt artifacts/hierarchical_message_system_tree.txt - name: 🚚 Move `artifacts` contents to website/generated run: | mkdir -p website/generated mv artifacts/* website/generated/ - name: 🔧 Build auto-generated code docs artifacts into HTML run: | cd website npm run generate-editor-structure - name: 📃 Generate node catalog documentation run: | cd tools/node-docs cargo run - name: 🌐 Build Graphite website with Zola env: MODE: prod run: | cd website npm ci 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