cours 2 postmortem #234
This file contains 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: Build and Deploy Github Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
deploy_trigger: | |
description: Force a deployment to pages | |
default: "false" | |
required: true | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install uv 🐍 | |
uses: astral-sh/setup-uv@v3 | |
with: | |
cache-dependency-glob: "**/requirements.txt" | |
cache-suffix: ${{ github.job }} | |
enable-cache: true | |
- name: Create base venv 🐙 | |
run: uv venv --python ${{ matrix.python-version }} | |
- name: Install dependencies 💁🏻 | |
run: | | |
source .venv/bin/activate | |
uv pip install --upgrade -r requirements.txt | |
- name: Build slides 📚 | |
run: | | |
source .venv/bin/activate | |
shopt -s globstar | |
jupytext --to ipynb ${{ github.workspace }}/**/*.py.md | |
jupyter nbconvert --execute --allow-errors --to html ${{ github.workspace }}/**/*.py.ipynb | |
# jupyter nbconvert --to slides ${{ github.workspace }}/slides/**/*-slides.py.ipynb | |
- name: Setup Ruby 💎 | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
cache-version: 0 # Increment this number if you need to re-download cached gems | |
- name: Setup Pages | |
id: pages | |
uses: actions/[email protected] | |
- name: Build with Jekyll 🔨 | |
run: bundle exec jekyll build --baseurl ${{ steps.pages.outputs.base_path }} # defaults output to '/_site' | |
- name: Upload artifact ⬆️ | |
uses: actions/upload-pages-artifact@v3 # This will automatically upload an artifact from the '/_site' directory | |
# Deployment job | |
deploy: | |
if: > | |
(github.event_name == 'push' && github.event.ref == 'refs/heads/main') || | |
(github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_trigger == | |
'true') | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
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 | |
# prebuild-binder: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout Code | |
# uses: actions/checkout@v2 | |
# - name: update jupyter dependencies with repo2docker | |
# uses: jupyterhub/repo2docker-action@master | |
# with: | |
# NO_PUSH: true | |
# MYBINDERORG_TAG: ${{ github.event.ref }} | |