whole lotta emails #36
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: Build and Deploy Plot | |
| on: | |
| push: | |
| paths: | |
| - "data/*.csv" | |
| - "data/*.parquet" | |
| - "main.py" | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install numpy pandas pyarrow plotly | |
| - name: Ensure output directory exists | |
| run: mkdir -p output | |
| - name: Detect changed data files | |
| id: changed | |
| run: | | |
| changed=$(git diff --name-only HEAD~1 HEAD | grep -E '\.(csv|parquet)$' || true) | |
| echo "changed=$changed" >> $GITHUB_OUTPUT | |
| - name: Run plot generator on changed files | |
| if: ${{ steps.changed.outputs.changed != '' }} | |
| run: | | |
| echo "Changed files:" | |
| echo ${{ steps.changed.outputs.changed }} | |
| for file in ${{ steps.changed.outputs.changed }}; do | |
| echo "Processing $file" | |
| .venv/bin/python main.py "$file" | |
| done | |
| - name: Compress HTML in output/ | |
| run: | | |
| if ls output/*.html 1> /dev/null 2>&1; then | |
| gzip -k output/*.html | |
| fi | |
| - name: Upload artifact for GitHub Pages | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: output/ | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy-pages.outputs.page_url }} | |
| steps: | |
| - name: Deploy GitHub Pages | |
| id: deploy-pages | |
| uses: actions/deploy-pages@v4 |