Merge pull request #6 from webmaxru/webmaxru-downloadable-pdf-edition #6
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 book to GitHub Pages | |
| # Builds the static site from content/ with site/generate.py and publishes it to the | |
| # gh-pages branch, which GitHub Pages serves (legacy branch source) at the custom | |
| # domain aw.isainative.dev. The committed images (cover, og-image, icons) ship as-is. | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "site/**" | |
| - "content/**" | |
| - "assets/**" | |
| - "scripts/**" | |
| - ".github/workflows/deploy-pages.yml" | |
| workflow_dispatch: | |
| # Only needs to push the built site to the gh-pages branch. | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: deploy-gh-pages | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Regenerate site from content | |
| env: | |
| APPINSIGHTS_CONNECTION_STRING: ${{ vars.APPINSIGHTS_CONNECTION_STRING }} | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install pyyaml | |
| python site/generate.py | |
| - name: Build downloadable PDF (single-page edition) | |
| # Renders site/book.html to site/gh-aw-book.pdf with headless Chromium so | |
| # the published PDF is regenerated on every book change and shipped in site/. | |
| run: | | |
| python -m pip install -r scripts/requirements-pdf.txt | |
| python -m playwright install --with-deps chromium | |
| python scripts/build_pdf.py | |
| - name: Publish site/ to gh-pages | |
| run: | | |
| cd site | |
| rm -rf __pycache__ | |
| touch .nojekyll | |
| git init -q -b gh-pages | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -q -m "Deploy ${GITHUB_SHA} from ${GITHUB_REF_NAME}" | |
| git push -q --force "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |