From ac7431f5c084bc1157be03bd93a944e0922ae202 Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 15:22:16 -0500 Subject: [PATCH 01/11] update examples env --- docs/Project.toml | 3 +++ examples/Project.toml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/Project.toml b/docs/Project.toml index c4a0f05..df691b8 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -5,6 +5,9 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" +[sources] +CopernicusClimateDataStore = {path = ".."} + [compat] CairoMakie = "0.12, 0.13" Documenter = "1" diff --git a/examples/Project.toml b/examples/Project.toml index 7d6a47c..9537122 100644 --- a/examples/Project.toml +++ b/examples/Project.toml @@ -3,6 +3,9 @@ CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" CopernicusClimateDataStore = "bce3f73f-acea-4481-bd86-df89ecc2cb46" NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" +[sources] +CopernicusClimateDataStore = {path = ".."} + [compat] CairoMakie = "0.12, 0.13" NCDatasets = "0.14, 0.15" From e5e04258169b828c7ab6d116e21d6d62a4a88351 Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 15:23:17 -0500 Subject: [PATCH 02/11] add docs workflow --- .github/workflows/Documentation.yml | 90 +++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/Documentation.yml diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml new file mode 100644 index 0000000..7cfbe95 --- /dev/null +++ b/.github/workflows/Documentation.yml @@ -0,0 +1,90 @@ +name: Documentation + +on: + push: + branches: + - main + tags: '*' + pull_request: + +# Allow only one concurrent deployment +concurrency: + group: pages-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: julia-actions/setup-julia@v2 + with: + version: '1' + + - uses: julia-actions/cache@v2 + + - name: Install dependencies + run: | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + + # Setup CDS credentials for examples that download data + - name: Setup CDS API credentials + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository + run: | + mkdir -p ~/.config/era5cli + echo "${{ secrets.CDS_API_KEY }}" > ~/.config/era5cli/cds_key.txt + env: + CDS_API_KEY: ${{ secrets.CDS_API_KEY }} + + - name: Build documentation + run: julia --project=docs docs/make.jl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + + - name: Upload documentation artifacts + uses: actions/upload-artifact@v4 + with: + name: documentation + path: docs/build/ + + deploy: + needs: build + runs-on: ubuntu-latest + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + + - uses: julia-actions/setup-julia@v2 + with: + version: '1' + + - uses: julia-actions/cache@v2 + + - name: Install dependencies + run: | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + + # Setup CDS credentials for examples + - name: Setup CDS API credentials + run: | + mkdir -p ~/.config/era5cli + echo "${{ secrets.CDS_API_KEY }}" > ~/.config/era5cli/cds_key.txt + env: + CDS_API_KEY: ${{ secrets.CDS_API_KEY }} + + - name: Build and deploy documentation + run: julia --project=docs docs/make.jl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + From 7933e8d612a78c25643d29954760718f61f4cb7d Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 15:25:51 -0500 Subject: [PATCH 03/11] deploy docs --- docs/make.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/make.jl b/docs/make.jl index 882c3a8..02a65a3 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -34,3 +34,9 @@ makedocs( ], ) +deploydocs( + repo = "github.com/glwagner/CopernicusClimateDataStore.jl.git", + devbranch = "main", + push_preview = true, +) + From f372429ee90cbae82536b2835132c04e5ba3519a Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 15:36:21 -0500 Subject: [PATCH 04/11] update README --- README.md | 128 +++++++++++++++++++++++++++--------------------------- 1 file changed, 65 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 7291ece..42ed69a 100644 --- a/README.md +++ b/README.md @@ -1,98 +1,100 @@ -# CopernicusClimateDataStore.jl + +

+ CopernicusClimateDataStore.jl +

-Julia wrapper around the [Copernicus Climate Data Store (CDS)](https://cds.climate.copernicus.eu/) -for downloading ERA5 reanalysis data. + +

+ 🌍 Julia interface to the Copernicus Climate Data Store for downloading ERA5 reanalysis data +

-## Installation +

+ + Documentation + +

+ +CopernicusClimateDataStore.jl wraps the [`era5cli`](https://era5cli.readthedocs.io/) command-line tool, +providing a convenient Julia interface for downloading ERA5 hourly and monthly data to NetCDF or GRIB. + +### Installation ```julia using Pkg -Pkg.add(url="https://github.com/YOUR_USERNAME/CopernicusClimateDataStore.jl") +Pkg.add(url="https://github.com/glwagner/CopernicusClimateDataStore.jl") ``` -## CDS Account Setup +### Before you start -Before downloading data, you must: +You need a Copernicus Climate Data Store account: -1. **Create a CDS account** at https://cds.climate.copernicus.eu/ -2. **Accept the Terms of Use** for the ERA5 dataset at - https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels?tab=download#manage-licences -3. **Configure your API key** by running: +1. **Create an account** at https://cds.climate.copernicus.eu/ +2. **Accept the ERA5 Terms of Use** at https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels +3. **Configure your API key**: ```bash era5cli config --key YOUR_PERSONAL_ACCESS_TOKEN ``` -Your personal access token can be found on your CDS profile page after logging in. +Your personal access token is on your [CDS profile page](https://cds.climate.copernicus.eu/). -## Quick Start +### Quick start + +Download and visualize 2-metre temperature over Europe: ```julia using CopernicusClimateDataStore using NCDatasets using CairoMakie -# Download 2m temperature for Europe, Jan 1, 2020 at 12:00 UTC -files = hourly( - variables = "2m_temperature", - startyear = 2020, - months = 1, - days = 1, - hours = 12, - area = (lat = (35, 60), lon = (-10, 25)), - format = "netcdf", - outputprefix = "europe" -) - -# Load the downloaded file -filename = first(files) -ds = NCDataset(filename) - -lon = ds["longitude"][:] -lat = ds["latitude"][:] -temp_C = ds["t2m"][:, :, 1] .- 273.15 +files = hourly(variables = "2m_temperature", + startyear = 2020, + months = 6, + days = 21, + hours = 12, + area = (lat = (35, 70), lon = (-15, 40)), + outputprefix = "europe") + +# Load the data +ds = NCDataset(first(files)) +λ = ds["longitude"][:] # degrees East +φ = ds["latitude"][:] # degrees North +T = ds["t2m"][:, :, 1] .- 273.15 # K → °C close(ds) # Plot -fig = Figure(size = (800, 600)) -ax = Axis(fig[1, 1], xlabel = "Longitude", ylabel = "Latitude") -hm = heatmap!(ax, lon, lat, temp_C', colormap = :thermal) -Colorbar(fig[1, 2], hm, label = "Temperature (°C)") +fig, ax, hm = heatmap(λ, φ, T'; colormap = :thermal) +Colorbar(fig[1, 2], hm; label = "Temperature (°C)") +ax.xlabel = "λ (°E)" +ax.ylabel = "φ (°N)" save("temperature.png", fig) ``` -## API - -### `hourly(; variables, startyear, ...)` +![](temperature.png) -Download ERA5 hourly data. +### Key arguments -**Key arguments:** -- `variables`: Variable name(s), e.g. `"2m_temperature"` -- `startyear`, `endyear`: Year range -- `months`, `days`, `hours`: Time filters -- `area`: Bounding box `(lat = (south, north), lon = (west, east))` -- `format`: `"netcdf"` (default) or `"grib"` -- `outputprefix`: Prefix for output filename -- `dryrun`: If `true`, print command without downloading -- `splitmonths`: Split output by month (default: `true`) -- `merge`: Merge all output into a single file (default: `false`) +| Argument | Description | +|:---------|:------------| +| `variables` | Variable name, e.g. `"2m_temperature"`, `"total_precipitation"` | +| `startyear` | Year to download (required) | +| `months` | Month or months (1–12) | +| `days` | Day or days (1–31) | +| `hours` | Hour or hours (0–23) | +| `area` | Bounding box: `(lat = (south, north), lon = (west, east))` | +| `format` | `"netcdf"` (default) or `"grib"` | +| `outputprefix` | Prefix for output filename | +| `merge` | Merge all data into a single file (default: `false`) | -**Note:** By default, one file is created per month. Use `merge=true` for a single file. +By default, one file is created per month. Use `merge = true` for a single file. ### Common variables | Request name | NetCDF name | Description | -|-------------|-------------|-------------| -| `2m_temperature` | `t2m` | 2 metre temperature (K) | -| `10m_u_component_of_wind` | `u10` | 10 metre U wind (m/s) | -| `10m_v_component_of_wind` | `v10` | 10 metre V wind (m/s) | +|:-------------|:------------|:------------| +| `2m_temperature` | `t2m` | 2-metre temperature (K) | +| `10m_u_component_of_wind` | `u10` | 10-metre zonal wind (m/s) | +| `10m_v_component_of_wind` | `v10` | 10-metre meridional wind (m/s) | | `total_precipitation` | `tp` | Total precipitation (m) | +| `mean_sea_level_pressure` | `msl` | Mean sea level pressure (Pa) | -## Examples - -See the `examples/` directory for Literate-style examples including an animation -of European temperature evolution. - -## License - -Apache License 2.0 +See the [CDS ERA5 documentation](https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels) for a complete list. From ea2871c802ba4f424b83f07b60f05567edcfb228 Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 15:51:10 -0500 Subject: [PATCH 05/11] add CDS keys or try to --- .github/workflows/Documentation.yml | 52 ++--------------------------- docs/literate.jl | 6 +++- 2 files changed, 7 insertions(+), 51 deletions(-) diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index 7cfbe95..b9596b6 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -7,55 +7,13 @@ on: tags: '*' pull_request: -# Allow only one concurrent deployment concurrency: group: pages-${{ github.ref }} cancel-in-progress: true jobs: - build: + build-and-deploy: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: julia-actions/setup-julia@v2 - with: - version: '1' - - - uses: julia-actions/cache@v2 - - - name: Install dependencies - run: | - julia --project=docs -e ' - using Pkg - Pkg.develop(PackageSpec(path=pwd())) - Pkg.instantiate()' - - # Setup CDS credentials for examples that download data - - name: Setup CDS API credentials - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository - run: | - mkdir -p ~/.config/era5cli - echo "${{ secrets.CDS_API_KEY }}" > ~/.config/era5cli/cds_key.txt - env: - CDS_API_KEY: ${{ secrets.CDS_API_KEY }} - - - name: Build documentation - run: julia --project=docs docs/make.jl - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - - - name: Upload documentation artifacts - uses: actions/upload-artifact@v4 - with: - name: documentation - path: docs/build/ - - deploy: - needs: build - runs-on: ubuntu-latest - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) permissions: contents: write steps: @@ -73,12 +31,6 @@ jobs: using Pkg Pkg.develop(PackageSpec(path=pwd())) Pkg.instantiate()' - - # Setup CDS credentials for examples - - name: Setup CDS API credentials - run: | - mkdir -p ~/.config/era5cli - echo "${{ secrets.CDS_API_KEY }}" > ~/.config/era5cli/cds_key.txt env: CDS_API_KEY: ${{ secrets.CDS_API_KEY }} @@ -87,4 +39,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - + CDS_API_KEY: ${{ secrets.CDS_API_KEY }} diff --git a/docs/literate.jl b/docs/literate.jl index 145c855..d80b12e 100644 --- a/docs/literate.jl +++ b/docs/literate.jl @@ -6,7 +6,11 @@ CairoMakie.activate!(type = "png") script_path = ARGS[1] literated_dir = ARGS[2] +# Only execute examples if CDS credentials are available (set EXECUTE_EXAMPLES=true to force) +# By default, skip execution since examples require ERA5 downloads +execute_examples = get(ENV, "EXECUTE_EXAMPLES", "false") == "true" + @time basename(script_path) Literate.markdown(script_path, literated_dir; flavor = Literate.DocumenterFlavor(), - execute = true) + execute = execute_examples) From 673edcccb8e9dac0d915bced2b6266e4b553a251 Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 15:52:12 -0500 Subject: [PATCH 06/11] always execute examples --- docs/literate.jl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/literate.jl b/docs/literate.jl index d80b12e..145c855 100644 --- a/docs/literate.jl +++ b/docs/literate.jl @@ -6,11 +6,7 @@ CairoMakie.activate!(type = "png") script_path = ARGS[1] literated_dir = ARGS[2] -# Only execute examples if CDS credentials are available (set EXECUTE_EXAMPLES=true to force) -# By default, skip execution since examples require ERA5 downloads -execute_examples = get(ENV, "EXECUTE_EXAMPLES", "false") == "true" - @time basename(script_path) Literate.markdown(script_path, literated_dir; flavor = Literate.DocumenterFlavor(), - execute = execute_examples) + execute = true) From e5cae5ffb8ac0b0d0539bc610e7cb286c94012cd Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 16:02:46 -0500 Subject: [PATCH 07/11] forget about examples for a sec --- docs/make.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index 02a65a3..6dd3931 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -13,6 +13,7 @@ examples = [ ("European temperature evolution", "european_temperature_evolution"), ] +#= for (title, basename) in examples script_path = joinpath(examples_src_dir, basename * ".jl") @info "Building example: $title" @@ -20,6 +21,7 @@ for (title, basename) in examples end example_pages = [title => joinpath("literated", basename * ".md") for (title, basename) in examples] +=# makedocs( sitename = "CopernicusClimateDataStore.jl", @@ -30,7 +32,7 @@ makedocs( ), pages = [ "Home" => "index.md", - "Examples" => example_pages, + # "Examples" => example_pages, ], ) From ad521b7b064c5b3d7bf85f2b5e64057415a375d9 Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 17:12:25 -0500 Subject: [PATCH 08/11] fix docs --- .gitignore | 8 ++++++++ docs/make.jl | 1 + docs/src/api.md | 24 ++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 docs/src/api.md diff --git a/.gitignore b/.gitignore index c178bd0..09f0117 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,11 @@ Manifest.toml *.png *.mp4 +*.js +*.html +*.css + +docs/build/ +docs/literated/ + + diff --git a/docs/make.jl b/docs/make.jl index 6dd3931..18b0817 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -33,6 +33,7 @@ makedocs( pages = [ "Home" => "index.md", # "Examples" => example_pages, + "API Reference" => "api.md", ], ) diff --git a/docs/src/api.md b/docs/src/api.md new file mode 100644 index 0000000..30acbfa --- /dev/null +++ b/docs/src/api.md @@ -0,0 +1,24 @@ +# API Reference + +## Main Functions + +```@docs +hourly +info +``` + +## Installation and CLI + +```@docs +install_era5cli +era5cli_cmd +``` + +## Internal Functions + +```@docs +CopernicusClimateDataStore.build_hourly_cmd +CopernicusClimateDataStore.format_area +CopernicusClimateDataStore.monthly +``` + From 473edf2fc54a9d15270c8790fa894dd05676efcb Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 17:55:40 -0500 Subject: [PATCH 09/11] fix urls --- README.md | 4 ++-- docs/make.jl | 2 +- docs/src/index.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 42ed69a..95b4701 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@

- + Documentation

@@ -21,7 +21,7 @@ providing a convenient Julia interface for downloading ERA5 hourly and monthly d ```julia using Pkg -Pkg.add(url="https://github.com/glwagner/CopernicusClimateDataStore.jl") +Pkg.add(url="https://github.com/NumericalEarth/CopernicusClimateDataStore.jl") ``` ### Before you start diff --git a/docs/make.jl b/docs/make.jl index 18b0817..3079a99 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -38,7 +38,7 @@ makedocs( ) deploydocs( - repo = "github.com/glwagner/CopernicusClimateDataStore.jl.git", + repo = "github.com/NumericalEarth/CopernicusClimateDataStore.jl.git", devbranch = "main", push_preview = true, ) diff --git a/docs/src/index.md b/docs/src/index.md index aa1cd4c..968a048 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -10,7 +10,7 @@ providing a convenient Julia interface for downloading ERA5 and ERA5-Land data. ```julia using Pkg -Pkg.add(url="https://github.com/YOUR_USERNAME/CopernicusClimateDataStore.jl") +Pkg.add(url="https://github.com/NumericalEarth/CopernicusClimateDataStore.jl") ``` ## CDS Account Setup From dd05df19d7762639aa7d5c657ffc856c070dfd06 Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 18:07:32 -0500 Subject: [PATCH 10/11] try dseparte build and deploy --- .github/workflows/Documentation.yml | 52 +++++++++++++++++++++++++---- docs/deploy.jl | 19 +++++++++++ docs/make.jl | 5 --- 3 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 docs/deploy.jl diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml index b9596b6..c388afd 100644 --- a/.github/workflows/Documentation.yml +++ b/.github/workflows/Documentation.yml @@ -8,14 +8,15 @@ on: pull_request: concurrency: - group: pages-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - build-and-deploy: + build-docs: + name: Build runs-on: ubuntu-latest permissions: - contents: write + contents: read steps: - uses: actions/checkout@v4 @@ -31,12 +32,49 @@ jobs: using Pkg Pkg.develop(PackageSpec(path=pwd())) Pkg.instantiate()' - env: - CDS_API_KEY: ${{ secrets.CDS_API_KEY }} - - name: Build and deploy documentation + - name: Build documentation run: julia --project=docs docs/make.jl env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: documentation-build + path: docs/build/ + retention-days: 7 + + deploy-docs: + name: Deploy + needs: build-docs + runs-on: ubuntu-latest + # Deploy on pushes to main or tags, and PRs from the same repo (not forks) + if: github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork) + permissions: + contents: write + pull-requests: read + statuses: write + concurrency: + group: docs-deploy + cancel-in-progress: false + steps: + - uses: actions/checkout@v4 + + - uses: julia-actions/setup-julia@v2 + with: + version: '1' + + - uses: actions/download-artifact@v4 + with: + name: documentation-build + path: docs/build/ + + - name: Install Documenter + run: julia -e 'using Pkg; Pkg.add("Documenter")' + + - name: Deploy documentation + run: julia docs/deploy.jl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - CDS_API_KEY: ${{ secrets.CDS_API_KEY }} diff --git a/docs/deploy.jl b/docs/deploy.jl new file mode 100644 index 0000000..65dd382 --- /dev/null +++ b/docs/deploy.jl @@ -0,0 +1,19 @@ +using Documenter + +@info "Cleaning up temporary files..." + +for (root, _, filenames) in walkdir(@__DIR__) + for file in filenames + if any(ext -> endswith(file, ext), (".jld2", ".nc", ".grib")) + rm(joinpath(root, file); force=true) + end + end +end + +deploydocs( + repo = "github.com/NumericalEarth/CopernicusClimateDataStore.jl", + devbranch = "main", + push_preview = true, + forcepush = true, +) + diff --git a/docs/make.jl b/docs/make.jl index 3079a99..d696e7c 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -37,9 +37,4 @@ makedocs( ], ) -deploydocs( - repo = "github.com/NumericalEarth/CopernicusClimateDataStore.jl.git", - devbranch = "main", - push_preview = true, -) From feb311dab2ac88a81eef3643296f1ba462e2a6f0 Mon Sep 17 00:00:00 2001 From: Gregory Wagner Date: Wed, 24 Dec 2025 18:07:39 -0500 Subject: [PATCH 11/11] update --- docs/deploy.jl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/deploy.jl b/docs/deploy.jl index 65dd382..e7f2b12 100644 --- a/docs/deploy.jl +++ b/docs/deploy.jl @@ -1,19 +1,20 @@ using Documenter -@info "Cleaning up temporary files..." +@info "Cleaning up temporary .jld2 and .nc output created by doctests or literated examples..." for (root, _, filenames) in walkdir(@__DIR__) for file in filenames - if any(ext -> endswith(file, ext), (".jld2", ".nc", ".grib")) + if any(occursin(file), (r"\.jld2$", r"\.nc$", r"\.grib$")) rm(joinpath(root, file); force=true) end end end -deploydocs( +deploydocs(; repo = "github.com/NumericalEarth/CopernicusClimateDataStore.jl", devbranch = "main", - push_preview = true, + # Only push previews if all the relevant environment variables are non-empty. This is an + # attempt to work around https://github.com/JuliaDocs/Documenter.jl/issues/2048. + push_preview = all(!isempty, (get(ENV, "GITHUB_TOKEN", ""), get(ENV, "DOCUMENTER_KEY", ""))), forcepush = true, ) -