name: "Website" on: workflow_dispatch: {} push: branches: - master paths: - website/** - frontend/eslint.config.js - frontend/eslint-require-data-selectors.js - frontend/package-lock.json pull_request: paths: - website/** - frontend/eslint.config.js - frontend/eslint-require-data-selectors.js - frontend/package-lock.json 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@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 - name: 🟢 Install Node.js uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 with: node-version-file: .nvmrc cache: npm cache-dependency-path: | frontend/package-lock.json website/package-lock.json - name: 🕸 Install Zola uses: taiki-e/install-action@1e29709c0ec63babbe8f266397a465f29a825f91 # v2.87.31 with: tool: zola@0.22.0 - name: 🔍 Check if `website/other` directory changed uses: dorny/paths-filter@0e4a8c6effa4802afeda77dc8d303f8176d7dfad # v3.0.4 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: 🦀 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 and frontend npm dependencies run: | # The website is linted by the frontend's ESLint config and the tools it installs cd frontend npm ci 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