Fix GitHub Pages: point to correct repo URLs #8
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 to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Install dependencies | |
| run: uv sync --no-dev | |
| - name: Prepare deployment | |
| run: | | |
| # Create _site directory | |
| mkdir -p ./_site/app/static | |
| # Copy docs (workshop walkthrough) to root | |
| cp -r docs/* ./_site/ | |
| # Copy static assets | |
| cp -r app/static/* ./_site/app/static/ | |
| # Render the start screen as a static page for GitHub Pages | |
| uv run python -c " | |
| from jinja2 import Environment, FileSystemLoader | |
| from app.models import GameState | |
| from app.game_service import GameSession | |
| env = Environment(loader=FileSystemLoader('app/templates')) | |
| # For static deploy, we need a self-contained HTML file | |
| session = GameSession() | |
| # Render home.html (extends base.html, so produces full page) | |
| template = env.get_template('home.html') | |
| full_html = template.render( | |
| session=session, | |
| GameState=GameState, | |
| url_for=lambda name, path='': f'/agent-lab-python/app/static/{path}' if name == 'static' else path, | |
| ) | |
| with open('_site/app/index.html', 'w') as f: | |
| f.write(full_html) | |
| " | |
| # Prevent Jekyll processing | |
| touch ./_site/.nojekyll | |
| - uses: actions/configure-pages@v4 | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _site | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |