Add a couple of papers #19
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: Render Papers | |
| on: | |
| push: | |
| branches: [master] | |
| concurrency: | |
| group: render-papers | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| render: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out master | |
| uses: actions/checkout@v4 | |
| with: | |
| path: master | |
| - name: Check out rendered branch | |
| run: | | |
| if git ls-remote --heads \ | |
| "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" \ | |
| rendered | grep -q rendered; then | |
| git clone --single-branch --branch rendered \ | |
| "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" \ | |
| rendered | |
| else | |
| mkdir -p rendered | |
| cd rendered | |
| git init | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout --orphan rendered | |
| git commit --allow-empty -m "Initial rendered branch" | |
| git remote add origin \ | |
| "https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git" | |
| fi | |
| - name: Install pandoc | |
| uses: pandoc/actions/setup@v1 | |
| - name: Install mermaid-filter | |
| run: npm install -g mermaid-filter | |
| # Google Chrome is pre-installed on ubuntu-latest. | |
| # Puppeteer (used by mermaid-filter) needs --no-sandbox on CI. | |
| # Create a wrapper so puppeteer's internal Chrome launch gets | |
| # the flag automatically. | |
| - name: Configure Chrome for CI | |
| run: | | |
| CHROME=$(which google-chrome || which chromium-browser || which chromium) | |
| cat > /tmp/chrome-no-sandbox <<WRAPPER | |
| #!/bin/bash | |
| exec "$CHROME" --no-sandbox --disable-setuid-sandbox "\$@" | |
| WRAPPER | |
| chmod +x /tmp/chrome-no-sandbox | |
| echo "PUPPETEER_EXECUTABLE_PATH=/tmp/chrome-no-sandbox" >> "$GITHUB_ENV" | |
| - name: Render papers | |
| id: render | |
| continue-on-error: true | |
| run: | | |
| set -o pipefail | |
| bash master/tools/render.sh master rendered 2>&1 | tee /tmp/render.log | |
| - name: Commit and push | |
| working-directory: rendered | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit" | |
| else | |
| SUBJECT=$(git -C "$GITHUB_WORKSPACE/master" log -1 --format=%s "$GITHUB_SHA") | |
| git commit -m "$(cat <<EOF | |
| Render from ${GITHUB_SHA::7}: $SUBJECT | |
| Source commit: ${{ github.repository }}@${GITHUB_SHA} | |
| EOF | |
| )" | |
| git push origin rendered | |
| fi | |
| - name: Fail if rendering had errors | |
| if: steps.render.outcome == 'failure' | |
| run: | | |
| cat /tmp/render.log | |
| exit 1 |