diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..9415d7f --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,55 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - main + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v4 + with: + enable-cache: true + + - name: Set up Python + run: uv python install + + - name: Install dependencies + run: uv sync + + - name: Build site + run: uv run python generate.py + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './dist' + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/generate.py b/generate.py index 8dbc8c9..1497a6d 100644 --- a/generate.py +++ b/generate.py @@ -17,6 +17,10 @@ if __name__ == '__main__': os.makedirs('dist/presentations', exist_ok=True) os.makedirs('dist/teaching', exist_ok=True) + # Create .nojekyll file to prevent GitHub Pages from using Jekyll + with open('dist/.nojekyll', 'w') as f: + pass + def render_template(template_name, output_path, **kwargs): template = env.get_template(template_name) html = template.render(year=current_year, **kwargs)