React Based Project with Sqlite #1
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
| # Builds the React app (with generated report.db), deploys to GitHub Pages. | |
| # Separate from weekly-report.yml, which runs on a schedule and commits report artifacts to the repo. | |
| name: Deploy to GitHub Pages | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Python dependencies | |
| run: pip install -r requirements.txt | |
| - name: Generate report and SQLite DB | |
| run: python -m src | |
| env: | |
| PYTHONPATH: . | |
| - name: Ensure report.db in UI/public | |
| run: | | |
| if [ -f report.db ] && [ ! -f UI/public/report.db ]; then | |
| cp report.db UI/public/report.db | |
| fi | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: npm install | |
| working-directory: UI | |
| - name: Build static site | |
| run: npm run build | |
| working-directory: UI | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| name: github-pages-${{ github.run_id }} | |
| path: UI/dist | |
| 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 | |
| with: | |
| artifact_name: github-pages-${{ github.run_id }} |