|
1 | | -name: Process Data & Publish Plots |
| 1 | +name: Build and Deploy Plot |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - paths: |
6 | | - - "data/**/*.csv" |
7 | | - - "data/**/*.parquet" |
| 5 | + branches: ["main"] |
8 | 6 |
|
9 | 7 | permissions: |
10 | | - id-token: write |
| 8 | + contents: read |
11 | 9 | pages: write |
12 | | - contents: write |
| 10 | + id-token: write |
13 | 11 |
|
14 | 12 | jobs: |
15 | 13 | build: |
16 | 14 | runs-on: ubuntu-latest |
17 | | - steps: |
18 | | - - name: Checkout repo |
19 | | - uses: actions/checkout@v4 |
20 | | - |
21 | | - - name: Setup Python |
22 | | - uses: actions/setup-python@v4 |
23 | | - with: |
24 | | - python-version: "3.11" |
25 | 15 |
|
26 | | - - name: Install dependencies |
27 | | - run: | |
28 | | - pip install numpy pandas plotly pyarrow |
29 | | -
|
30 | | - - name: Make output directory |
31 | | - run: mkdir -p output |
32 | | - |
33 | | - - name: Run main.py for changed data files |
34 | | - id: generate |
35 | | - run: | |
36 | | - echo "Changed files:" |
37 | | - echo "${{ github.event.head_commit.modified }}" |
38 | | - |
39 | | - # Detect changed CSV/parquet files |
40 | | - changed=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -E "\.csv$|\.parquet$" || true) |
| 16 | + steps: |
41 | 17 |
|
42 | | - if [ -z "$changed" ]; then |
43 | | - echo "No new data files found." |
44 | | - exit 0 |
45 | | - fi |
| 18 | + - name: Checkout repo |
| 19 | + uses: actions/checkout@v4 |
46 | 20 |
|
47 | | - echo "$changed" | while read file; do |
48 | | - echo "Processing $file ..." |
49 | | - python main.py "$file" |
50 | | - done |
| 21 | + - name: Set up Python |
| 22 | + uses: actions/setup-python@v5 |
| 23 | + with: |
| 24 | + python-version: "3.11" |
51 | 25 |
|
52 | | - - name: List output contents |
53 | | - run: | |
54 | | - echo "Output directory contains:" |
55 | | - ls -lh output || echo "output directory missing" |
| 26 | + - name: Install dependencies |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + pip install uv |
| 30 | + uv sync |
56 | 31 |
|
57 | | - - name: Compress HTML files (if any) |
58 | | - run: | |
59 | | - shopt -s nullglob |
60 | | - files=(output/*.html) |
| 32 | + - name: Run plotter |
| 33 | + run: | |
| 34 | + mkdir -p output |
| 35 | + python main.py data/datadump_11-6-whatisevenhappening.csv |
61 | 36 |
|
62 | | - if [ ${#files[@]} -eq 0 ]; then |
63 | | - echo "No HTML files to compress." |
64 | | - exit 0 |
65 | | - fi |
| 37 | + - name: Confirm output contents |
| 38 | + run: | |
| 39 | + echo "PWD: $(pwd)" |
| 40 | + echo "Repo contents:" |
| 41 | + ls -R . |
66 | 42 |
|
67 | | - for f in "${files[@]}"; do |
68 | | - echo "Compressing $f ..." |
69 | | - gzip -9 "$f" |
70 | | - mv "$f.gz" "$f" |
71 | | - done |
| 43 | + - name: Compress HTML files |
| 44 | + run: | |
| 45 | + echo "Compressing output/*..." |
| 46 | + cd output |
| 47 | + ls -l |
| 48 | + for f in *.html; do |
| 49 | + gzip -9 "$f" |
| 50 | + done |
72 | 51 |
|
73 | | - - name: Upload artifact for Pages |
74 | | - uses: actions/upload-pages-artifact@v2 |
75 | | - with: |
76 | | - path: output |
| 52 | + - name: Upload artifact for GitHub Pages |
| 53 | + uses: actions/upload-pages-artifact@v3 |
| 54 | + with: |
| 55 | + path: output |
77 | 56 |
|
78 | 57 | deploy: |
79 | 58 | needs: build |
80 | 59 | runs-on: ubuntu-latest |
81 | 60 | environment: |
82 | 61 | name: github-pages |
83 | 62 | url: ${{ steps.deployment.outputs.page_url }} |
| 63 | + |
84 | 64 | steps: |
85 | 65 | - name: Deploy to GitHub Pages |
86 | 66 | id: deployment |
87 | | - uses: actions/deploy-pages@v2 |
| 67 | + uses: actions/deploy-pages@v4 |
0 commit comments