Create Images and Make Release #369
This file contains 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: 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' | |