Fix GitHub Actions build errors: #32
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: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-and-deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Build House_Code with FirstFlask.sh | |
| run: | | |
| if [ ! -d "House_Code" ]; then | |
| bash FirstFlask.sh | |
| fi | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| cd House_Code | |
| pip install -r requirements.txt | |
| # Ensure jinja2 is installed for the static site generator | |
| pip install jinja2 | |
| - name: Debug current directory structure | |
| run: | | |
| echo "Contents of working directory:" | |
| ls -la | |
| echo "Contents of House_Code directory:" | |
| ls -la House_Code/ | |
| echo "Contents of templates directory:" | |
| ls -la House_Code/templates/ | |
| echo "Contents of static directory:" | |
| ls -la House_Code/static/ | |
| echo "Contents of _svg_assets directory:" | |
| ls -la _svg_assets/ | |
| - name: Generate static site | |
| run: | | |
| echo "Current working directory: $(pwd)" | |
| # Create debugging info | |
| cd House_Code | |
| echo "Looking for templates directory:" | |
| ls -la templates || echo "Templates directory not found!" | |
| echo "Looking for static directory:" | |
| ls -la static || echo "Static directory not found!" | |
| echo "Python and Jinja2 versions:" | |
| python -c "import sys; print(f'Python version: {sys.version}')" | |
| python -c "import jinja2; print(f'Jinja2 version: {jinja2.__version__}')" || echo "Jinja2 not installed properly!" | |
| echo "Running static site generator with verbose output:" | |
| python -v generate_static_site.py | |
| echo "Static site generation complete, checking results:" | |
| if [ -d "gh-pages" ]; then | |
| echo "gh-pages directory exists:" | |
| ls -la gh-pages | |
| if [ -d "gh-pages/svg" ]; then | |
| echo "SVG directory exists:" | |
| ls -la gh-pages/svg | |
| else | |
| echo "ERROR: SVG directory not found!" | |
| fi | |
| else | |
| echo "ERROR: gh-pages directory not found!" | |
| exit 1 | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: "./House_Code/gh-pages" | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |