updated lectures 12, 13, and 14 #173
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 Demos to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'demos/**' | |
| - 'slides/**' | |
| - 'syllabus/**' | |
| - 'assignments/**' | |
| - 'figures/**' | |
| - 'fonts/**' | |
| - 'index.html' | |
| - '.github/workflows/deploy-demos.yml' | |
| workflow_run: | |
| workflows: ["Build Course Pages"] | |
| types: [completed] | |
| branches: [main] | |
| workflow_dispatch: | |
| # Sets permissions for GitHub Pages deployment | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Validate HTML files | |
| run: | | |
| echo "Validating HTML structure..." | |
| # Check if index.html exists | |
| if [ ! -f "demos/index.html" ]; then | |
| echo "Error: demos/index.html not found" | |
| exit 1 | |
| fi | |
| echo "HTML validation passed!" | |
| - name: Check for broken links (basic) | |
| run: | | |
| echo "Checking for basic issues in demos..." | |
| # Simple check for common issues | |
| find demos -name "*.html" -type f | while read file; do | |
| echo "Checking: $file" | |
| # Check for basic HTML structure | |
| if ! grep -q "<!DOCTYPE html>" "$file"; then | |
| echo "Warning: $file missing DOCTYPE declaration" | |
| fi | |
| done | |
| - name: Create build artifact | |
| run: | | |
| echo "Preparing site for deployment..." | |
| mkdir -p _site/demos | |
| mkdir -p _site/slides | |
| mkdir -p _site/syllabus | |
| mkdir -p _site/assignments | |
| mkdir -p _site/figures | |
| mkdir -p _site/fonts | |
| cp index.html _site/ | |
| cp -r demos/* _site/demos/ | |
| cp -rL slides/* _site/slides/ | |
| cp -r syllabus/* _site/syllabus/ | |
| cp -r assignments/*.html _site/assignments/ 2>/dev/null || true | |
| cp -r assignments/*.md _site/assignments/ 2>/dev/null || true | |
| for dir in assignments/assignment-* assignments/final-project; do | |
| if [ -d "$dir" ]; then | |
| cp -r "$dir" _site/assignments/ | |
| fi | |
| done | |
| # Copy assignment submodules (for data files like instructions.txt, training.zip) | |
| for dir in assignments/*-llm-course; do | |
| if [ -d "$dir" ]; then | |
| cp -r "$dir" _site/assignments/ | |
| fi | |
| done | |
| cp -r figures/* _site/figures/ | |
| cp -r fonts/* _site/fonts/ | |
| touch _site/.nojekyll | |
| # Create a custom 404 page | |
| cat > _site/404.html << 'EOF' | |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>404 - Page Not Found</title> | |
| <style> | |
| body { | |
| margin: 0; | |
| padding: 0; | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| color: white; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| min-height: 100vh; | |
| text-align: center; | |
| } | |
| .container { | |
| max-width: 600px; | |
| padding: 2rem; | |
| } | |
| h1 { | |
| font-size: 6rem; | |
| margin: 0; | |
| font-weight: 700; | |
| } | |
| p { | |
| font-size: 1.5rem; | |
| margin: 1rem 0 2rem; | |
| } | |
| a { | |
| display: inline-block; | |
| padding: 1rem 2rem; | |
| background: white; | |
| color: #667eea; | |
| text-decoration: none; | |
| border-radius: 8px; | |
| font-weight: 600; | |
| transition: transform 0.3s ease; | |
| } | |
| a:hover { | |
| transform: translateY(-2px); | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h1>404</h1> | |
| <p>Oops! This demo doesn't exist yet.</p> | |
| <a href="/">Return to Demo Gallery</a> | |
| </div> | |
| </body> | |
| </html> | |
| EOF | |
| echo "Build artifact created successfully!" | |
| - name: List build contents | |
| run: | | |
| echo "Build directory structure:" | |
| ls -la _site/ | |
| echo "" | |
| echo "Figures and fonts:" | |
| ls -la _site/figures/ | head -10 | |
| ls -la _site/fonts/ | head -10 | |
| echo "" | |
| echo "Demos available:" | |
| find _site -type d -maxdepth 1 | sort | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: '_site' | |
| # Deployment job | |
| 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 | |
| - name: Display deployment URL | |
| run: | | |
| echo "🎉 Demos deployed successfully!" | |
| echo "📦 URL: ${{ steps.deployment.outputs.page_url }}" | |
| echo "" | |
| echo "Available demos:" | |
| echo "- Main Gallery: ${{ steps.deployment.outputs.page_url }}" | |
| echo "- ELIZA: ${{ steps.deployment.outputs.page_url }}01-eliza/" | |
| echo "- Chatbot Evolution: ${{ steps.deployment.outputs.page_url }}02-chatbot-evolution/" | |
| echo "- Tokenization: ${{ steps.deployment.outputs.page_url }}03-tokenization/" | |
| echo "- Embeddings: ${{ steps.deployment.outputs.page_url }}04-embeddings/" | |
| echo "- Attention: ${{ steps.deployment.outputs.page_url }}05-attention/" | |
| echo "- Transformer: ${{ steps.deployment.outputs.page_url }}06-transformer/" | |
| echo "- GPT Playground: ${{ steps.deployment.outputs.page_url }}07-gpt-playground/" | |
| # Optional: Verify deployment | |
| verify: | |
| runs-on: ubuntu-latest | |
| needs: deploy | |
| steps: | |
| - name: Verify deployment | |
| run: | | |
| echo "Deployment verification complete!" | |
| echo "Demos should now be live at GitHub Pages." | |
| echo "" | |
| echo "To enable GitHub Pages:" | |
| echo "1. Go to repository Settings" | |
| echo "2. Navigate to Pages section" | |
| echo "3. Under 'Build and deployment', select 'GitHub Actions' as the source" | |
| echo "4. Save changes" |