Daily FOI Scrape and MkDocs Update #117
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: Daily FOI Scrape and MkDocs Update | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| schedule: | |
| - cron: '30 8 * * 4' # weekly: Monday at 05:00 UTC | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gfortran default-jre | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.10' | |
| - name: Show current directory contents | |
| run: | | |
| echo "Current directory: $(pwd)" | |
| ls -la | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| # (Make sure mkdocs is also in requirements.txt, or add: pip install mkdocs) | |
| - name: Run Python script | |
| run: | | |
| echo "Running scrape script" | |
| python foi-csc-scrape-tool.py | |
| - name: Build MkDocs site | |
| run: mkdocs build # → generates ./site/ | |
| - name: Show generated site/ contents # sanity check to view in workflow console outputs | |
| run: | | |
| echo "---- site/ directory after build ----" | |
| ls -R site | |
| - name: Commit any updated Markdown content | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add docs/*.md | |
| git commit -m "Update MkDocs content via workflow" || echo "No changes to commit" | |
| git push | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./site |