Cleaning up #2
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
# This workflow builds and deploys marimo notebooks to GitHub Pages | |
# It runs automatically when changes are pushed to the main branch or can be triggered manually | |
name: Deploy to GitHub Pages | |
# Defines when the workflow will run | |
on: | |
push: | |
branches: ['main'] # Trigger on pushes to main branch | |
workflow_dispatch: # Allow manual triggering from the GitHub UI | |
# Concurrency settings to manage multiple workflow runs | |
concurrency: | |
group: 'pages' # Only one workflow in the 'pages' group can run at a time | |
cancel-in-progress: false # Don't cancel in-progress runs when a new one is triggered | |
# Environment variables used by the workflow | |
env: | |
UV_SYSTEM_PYTHON: 1 # Use system Python with uv package manager | |
jobs: | |
# The build job exports marimo notebooks to static HTML/WebAssembly | |
build: | |
runs-on: ubuntu-latest # Use the latest Ubuntu runner | |
steps: | |
# Check out the repository code | |
- uses: actions/checkout@v4 | |
# Install uv package manager for faster Python package installation | |
- name: 🚀 Install uv | |
uses: astral-sh/setup-uv@v6 | |
# Run the build script to export notebooks to WebAssembly | |
- name: 🛠️ Export notebooks | |
run: | | |
# todo: Ultimately this function should not be part of this repo | |
# It should very much be an action such that other repos | |
# can use it without forking or copying it | |
# No, it should not be an action. As otherwise can't run before push | |
uv run .github/scripts/build.py # This script exports all notebooks to the _site directory | |
tree _site # Display the exported files | |
# Upload the generated site as an artifact for the deploy job | |
- name: 📤 Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: _site # Directory containing the built site | |
# The deploy job publishes the built site to GitHub Pages | |
deploy: | |
needs: build # This job depends on the build job completing successfully | |
# Required permissions for the GitHub Pages deployment | |
permissions: | |
pages: write # Permission to deploy to Pages | |
id-token: write # Permission to verify the deployment | |
# Configure the deployment environment | |
environment: | |
name: github-pages # Deploy to the github-pages environment | |
url: ${{ steps.deployment.outputs.page_url }} # Use the URL from the deployment step | |
runs-on: ubuntu-latest # Use the latest Ubuntu runner | |
steps: | |
# Deploy the site to GitHub Pages using the official action | |
- name: 🚀 Deploy to GitHub Pages | |
id: deployment # ID used to reference this step's outputs | |
uses: actions/deploy-pages@v4 # GitHub's official Pages deployment action |