React Based Project with Sqlite #12
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
| # Runs on schedule (and push to master): generates report, builds UI, commits index.html/report.db/assets to repo. | |
| # Separate from deploy-pages.yml, which deploys the React app to GitHub Pages. | |
| name: Monthly site report | |
| on: | |
| schedule: | |
| - cron: '0 0 1 * *' | |
| push: | |
| branches: [master] | |
| jobs: | |
| generate-report: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: master | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Setup Node (for Lighthouse via npx) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install Python dependencies | |
| run: pip install -r requirements.txt | |
| - name: Generate report | |
| run: python -m src | |
| - name: Build React UI | |
| run: | | |
| cd UI && npm ci && npm run build | |
| - name: Copy report.db and build to root for deployment | |
| run: | | |
| cp report.db UI/dist/ | |
| cp -r UI/dist/index.html UI/dist/assets . 2>/dev/null || true | |
| cp report.db . | |
| - name: Commit and push report to repo | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -f index.html report.db assets | |
| git diff --staged --quiet || git commit -m "cron: monthly site report" | |
| git push | |
| - name: Upload report artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: site-report-${{ github.run_number }} | |
| path: | | |
| index.html | |
| report.db | |
| assets | |
| site_graph.svg | |
| if-no-files-found: ignore |