-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (70 loc) · 2.85 KB
/
make-images.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Create Images and Make Release
on:
workflow_dispatch:
schedule:
# Data is updated at 9am EDT = 13:00 hrs UTC, so run just after that
# min hr dom mo dow
- cron: '15 13 * * *'
jobs:
make-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Use "uv" for python and dependency management
- uses: astral-sh/setup-uv@v2
with:
enable-cache: true
- name: Install dependencies
run: uv sync
- name: Generate graphs
run: |
uv run prune-cache.py --inplace --days 90 # Re-fetch most recent 90 days, in case of reanalysis
uv run sea-surface-temps.py --mode graph --dataset sst --out sst-all.png
uv run sea-surface-temps.py --mode graph --dataset anom --out sst-all-anom.png
uv run sea-surface-temps.py --mode graph --dataset sst --out sst-all.svg
uv run sea-surface-temps.py --mode graph --dataset anom --out sst-all-anom.svg
# Maps: OK if these fail; we're looking for yesterday, might not be there yet.
- name: Generate maps
run: |
uv run sea-surface-temps.py --mode map --dataset sst --days-ago 2 --out sst-map.png || true
uv run sea-surface-temps.py --mode map --dataset anom --days-ago 2 --out sst-anom-map.png || true
# This generates textures (.png) and associated colormap json files (-metadata.json)
- name: Generate map textures
run: |
rm -rf ./maps
mkdir -p ./maps
uv run sea-surface-temps.py --mode texture --dataset sst --days-ago 2 --out maps/sst-temp-equirect.png || true
uv run sea-surface-temps.py --mode texture --dataset anom --days-ago 2 --out maps/sst-temp-anomaly-equirect.png || true
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ steps.date.outputs.date }}
tag_name: ${{ steps.date.outputs.date }}
draft: false
prerelease: false
body: "Latest plots as of ${{ steps.date.outputs.date }}"
files: |
sst-map.png
sst-anom-map.png
sst-all.png
sst-all-anom.png
sst-all.svg
sst-all-anom.svg
maps/sst-temp-equirect.png
maps/sst-temp-equirect-metadata.json
maps/sst-temp-anomaly-equirect.png
maps/sst-temp-anomaly-equirect-metadata.json
- name: Copy plot files to AWS S3 bucket
uses: prewk/s3-cp-action@v2
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
source: './maps/'
dest: 's3://climate-change-assets/sea-surface-temp/'
flags: '--recursive'