Deploy Pages #1426
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: Deploy Pages | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'web/**' | |
| - 'projects/**/paper/pdf/**.pdf' | |
| - '.github/workflows/pages.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: pages-deploy | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Sync web/ -> docs/ | |
| run: | | |
| rm -rf docs | |
| cp -R web docs | |
| touch docs/.nojekyll | |
| - name: Mirror paper PDFs into docs/ for same-origin inline rendering | |
| # raw.githubusercontent.com serves PDFs with Content-Disposition: | |
| # attachment + X-Frame-Options: deny so browsers refuse to render | |
| # them inline. GitHub Pages serves PDFs from the same origin with a | |
| # proper Content-Type: application/pdf, so we mirror every paper PDF | |
| # under docs/papers/<project_id>/<filename>.pdf for the paper modal | |
| # to embed. | |
| run: | | |
| set -euo pipefail | |
| mkdir -p docs/papers | |
| # File paths are entirely under our control here (repo-checked-out | |
| # paths only). No untrusted input is interpolated into the shell. | |
| while IFS= read -r src; do | |
| proj=$(echo "$src" | awk -F/ '{print $2}') | |
| name=$(basename "$src") | |
| mkdir -p "docs/papers/$proj" | |
| cp "$src" "docs/papers/$proj/$name" | |
| done < <(find projects -path 'projects/*/paper/pdf/*.pdf' -type f) | |
| - name: Commit if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add docs | |
| if git diff --cached --quiet; then | |
| echo "no changes" | |
| else | |
| git commit -m "deploy: sync web/ -> docs/ for GitHub Pages [skip ci]" | |
| git push | |
| fi |