Docs Site #156
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: Docs Site | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 * * * *" | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| AWS_REGION: ${{ secrets.AWS_REGION != '' && secrets.AWS_REGION || 'us-east-1' }} | |
| SCFUZZBENCH_BUCKET: ${{ secrets.SCFUZZBENCH_BUCKET }} | |
| ZERION_API_KEY: ${{ secrets.ZERION_API_KEY }} | |
| steps: | |
| - name: Checkout (tarball) | |
| timeout-minutes: 5 | |
| env: | |
| REPO: ${{ github.repository }} | |
| SHA: ${{ github.sha }} | |
| run: | | |
| set -euo pipefail | |
| url="https://codeload.github.com/${REPO}/tar.gz/${SHA}" | |
| curl -fsSL "${url}" -o repo.tar.gz | |
| # Avoid SIGPIPE failures from `head` when pipefail is set. | |
| topdir="$(tar -tzf repo.tar.gz | sed -n '1p' | cut -d/ -f1)" | |
| tar -xzf repo.tar.gz | |
| shopt -s dotglob | |
| mv "${topdir}"/* . | |
| rm -rf "${topdir}" repo.tar.gz | |
| - name: Ensure AWS configuration is present | |
| run: | | |
| if [ -z "${{ secrets.AWS_ACCESS_KEY_ID }}" ] || [ -z "${{ secrets.AWS_SECRET_ACCESS_KEY }}" ]; then | |
| echo "Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY secrets." >&2 | |
| exit 1 | |
| fi | |
| if [ -z "${SCFUZZBENCH_BUCKET}" ]; then | |
| echo "Set SCFUZZBENCH_BUCKET secret." >&2 | |
| exit 1 | |
| fi | |
| - name: Configure AWS credentials (keys) | |
| uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ env.AWS_REGION }} | |
| - name: Setup Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Setup Node | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| - name: Install Node deps | |
| run: npm ci | |
| - name: Generate AWS transparency payload | |
| run: | | |
| python3 scripts/generate_cost_transparency.py | |
| - name: Generate grant wallet payload | |
| run: | | |
| python3 scripts/generate_grant_wallet.py --allow-unavailable | |
| - name: Generate docs from S3 index | |
| run: | | |
| python3 scripts/generate_docs_site.py --bucket "${SCFUZZBENCH_BUCKET}" --region "${AWS_REGION}" | |
| - name: Build site | |
| run: npm run docs:build | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 | |
| with: | |
| path: docs/.vitepress/dist | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 |