name: Deploy Project Website to GitHub Pages on: push: branches: - main # Deploy when pushing to main branch paths: # Trigger deployment only when content or website files change # Code changes (src/) don't trigger it, so a docstring change doesn't update the API reference (pdoc). # To update it, run this workflow manually (Actions tab, workflow_dispatch). - 'afterpython/doc/**' - 'afterpython/blog/**' - 'afterpython/tutorial/**' - 'afterpython/example/**' - 'afterpython/guide/**' - 'afterpython/static/**' - 'afterpython/_website/**' - 'afterpython/authors.yml' - 'afterpython/faq.yml' - 'afterpython/README.py' - 'afterpython/afterpython.toml' # metadata.json (name, version, urls) and the homepage description - 'pyproject.toml' - 'README.md' - '.github/workflows/deploy.yml' workflow_dispatch: # Allow manual deployment from Actions tab # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v7 - name: Install pnpm uses: pnpm/action-setup@v6 with: version: 10 - name: Set up Node.js uses: actions/setup-node@v7 with: node-version: '24' cache: 'pnpm' cache-dependency-path: './afterpython/_website/pnpm-lock.yaml' - name: Install uv uses: astral-sh/[email protected] - name: Install the project # afterpython itself (the project) + its marimo extra, for the marimo README.py, at uv.lock's versions run: uv sync --locked --extra marimo - name: Install website dependencies run: pnpm install working-directory: ./afterpython/_website - name: Build website run: uv run --no-sync ap build - name: Upload artifact uses: actions/upload-pages-artifact@v5 with: path: './afterpython/_website/build' deploy: environment: name: github-pages # This will dynamically generate the deployment URL url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v5