From efa4210b4860b8dd164893d4e52735a4294dbd41 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Sat, 21 Sep 2024 10:16:25 -0700 Subject: [PATCH 01/10] Add status permissions to doc deployment --- .github/workflows/main.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index df70553..9cad9e0 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + statuses: write steps: - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v2 From d0468d4b87d47264b2b20696bdaf55f2e9343232 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Sat, 21 Sep 2024 10:48:04 -0700 Subject: [PATCH 02/10] Create clear_cache.yml This adds a manually triggerable workflow to clear all caches. Useful if you need to force rebuild/update of envs! --- .github/workflows/clear_cache.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/clear_cache.yml diff --git a/.github/workflows/clear_cache.yml b/.github/workflows/clear_cache.yml new file mode 100644 index 0000000..4972601 --- /dev/null +++ b/.github/workflows/clear_cache.yml @@ -0,0 +1,30 @@ +name: Clear cache + +on: + workflow_dispatch: + +permissions: + actions: write + +jobs: + clear-cache: + runs-on: ubuntu-latest + steps: + - name: Clear cache + uses: actions/github-script@v6 + with: + script: | + console.log("About to clear") + const caches = await github.rest.actions.getActionsCacheList({ + owner: context.repo.owner, + repo: context.repo.repo, + }) + for (const cache of caches.data.actions_caches) { + console.log(cache) + github.rest.actions.deleteActionsCacheById({ + owner: context.repo.owner, + repo: context.repo.repo, + cache_id: cache.id, + }) + } + console.log("Clear completed") From f0ec5e75e9e68ef90603fcd7486fcaf2f9199ce4 Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sun, 22 Sep 2024 16:27:42 +0200 Subject: [PATCH 03/10] tests new gha approach --- .github/workflows/main.yaml | 90 ++++++++++++++++----------------- .github/workflows/main_new.yaml | 39 ++++++++++++++ _publish.yml | 4 ++ 3 files changed, 88 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/main_new.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 9cad9e0..51ff7bd 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,47 +1,47 @@ -on: - workflow_dispatch: - push: - branches: - [main] - pull_request: -name: Quarto Publish -jobs: - bookdown: - name: GH-Pages - runs-on: ubuntu-latest - permissions: - contents: write - statuses: write - steps: - - uses: actions/checkout@v3 - - uses: julia-actions/setup-julia@v2 - - uses: julia-actions/cache@v2 - - name: Set up custom Julia dependencies - run: | - using Pkg - Pkg.activate("quarto"; shared = true) - # TODO: QuartoNotebookRunner does not support execute-dir yet, but this PR does. - Pkg.add(url = "https://github.com/asinghvi17/QuartoNotebookRunner.jl", rev = "as/execute-dir") - Pkg.instantiate() - Pkg.activate(".") - Pkg.add([ - # TODO: DimensionalData v0.28 is not compatible with Rasters latest version, - # and has Makie fixes that we need for the book, otherwise plotting errors out. - # These can be removed after Rasters.jl's new breaking version. - PackageSpec(url = "https://github.com/asinghvi17/Rasters.jl", rev = "as/dd28"), - PackageSpec(url = "https://github.com/rafaqz/DimensionalData.jl", rev = "main"), - ]) - shell: julia {0} - - uses: julia-actions/julia-buildpkg@v1 +# on: +# workflow_dispatch: +# push: +# branches: +# [main] +# pull_request: +# name: Quarto Publish +# jobs: +# bookdown: +# name: GH-Pages +# runs-on: ubuntu-latest +# permissions: +# contents: write +# statuses: write +# steps: +# - uses: actions/checkout@v3 +# - uses: julia-actions/setup-julia@v2 +# - uses: julia-actions/cache@v2 +# - name: Set up custom Julia dependencies +# run: | +# using Pkg +# Pkg.activate("quarto"; shared = true) +# # TODO: QuartoNotebookRunner does not support execute-dir yet, but this PR does. +# Pkg.add(url = "https://github.com/asinghvi17/QuartoNotebookRunner.jl", rev = "as/execute-dir") +# Pkg.instantiate() +# Pkg.activate(".") +# Pkg.add([ +# # TODO: DimensionalData v0.28 is not compatible with Rasters latest version, +# # and has Makie fixes that we need for the book, otherwise plotting errors out. +# # These can be removed after Rasters.jl's new breaking version. +# PackageSpec(url = "https://github.com/asinghvi17/Rasters.jl", rev = "as/dd28"), +# PackageSpec(url = "https://github.com/rafaqz/DimensionalData.jl", rev = "main"), +# ]) +# shell: julia {0} +# - uses: julia-actions/julia-buildpkg@v1 - - name: Set up Quarto - uses: quarto-dev/quarto-actions/setup@v2 - env: - QUARTO_JULIA_PROJECT: "@quarto" +# - name: Set up Quarto +# uses: quarto-dev/quarto-actions/setup@v2 +# env: +# QUARTO_JULIA_PROJECT: "@quarto" - - name: Render and Publish - run: julia helpers/deploy_with_preview.jl - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - QUARTO_JULIA_PROJECT: "@quarto" - DATAFRAMES_ROWS: "6" +# - name: Render and Publish +# run: julia helpers/deploy_with_preview.jl +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# QUARTO_JULIA_PROJECT: "@quarto" +# DATAFRAMES_ROWS: "6" diff --git a/.github/workflows/main_new.yaml b/.github/workflows/main_new.yaml new file mode 100644 index 0000000..4d486ed --- /dev/null +++ b/.github/workflows/main_new.yaml @@ -0,0 +1,39 @@ +jobs: + bookdown: + name: GH-Pages + runs-on: ubuntu-latest + permissions: + contents: write + statuses: write + steps: + - uses: actions/checkout@v3 + - uses: julia-actions/setup-julia@v2 + - uses: julia-actions/cache@v2 + - name: Set up custom Julia dependencies + run: | + using Pkg + Pkg.activate("quarto"; shared = true) + # TODO: QuartoNotebookRunner does not support execute-dir yet, but this PR does. + Pkg.add(url = "https://github.com/asinghvi17/QuartoNotebookRunner.jl", rev = "as/execute-dir") + Pkg.instantiate() + Pkg.activate(".") + Pkg.add([ + # TODO: DimensionalData v0.28 is not compatible with Rasters latest version, + # and has Makie fixes that we need for the book, otherwise plotting errors out. + # These can be removed after Rasters.jl's new breaking version. + PackageSpec(url = "https://github.com/asinghvi17/Rasters.jl", rev = "as/dd28"), + PackageSpec(url = "https://github.com/rafaqz/DimensionalData.jl", rev = "main"), + ]) + shell: julia {0} + - uses: julia-actions/julia-buildpkg@v1 + + - name: Set up Quarto + uses: quarto-dev/quarto-actions/setup@v2 + env: + QUARTO_JULIA_PROJECT: "@quarto" + + - name: Render and Publish + uses: quarto-dev/quarto-actions/publish@v2 + with: + target: netlify + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} \ No newline at end of file diff --git a/_publish.yml b/_publish.yml index e69de29..b86cace 100644 --- a/_publish.yml +++ b/_publish.yml @@ -0,0 +1,4 @@ +- source: project + netlify: + - id: "e18690e5-215e-4584-b0f1-963bc99a10d0" + url: "https://jl.geocompx.org" \ No newline at end of file From 7198f9d8d4be07d41d14409fb0d16867bf335165 Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sun, 22 Sep 2024 16:30:22 +0200 Subject: [PATCH 04/10] adds missing part --- .github/workflows/main_new.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main_new.yaml b/.github/workflows/main_new.yaml index 4d486ed..37300a2 100644 --- a/.github/workflows/main_new.yaml +++ b/.github/workflows/main_new.yaml @@ -1,3 +1,10 @@ +on: + workflow_dispatch: + push: + branches: + [main] + pull_request: +name: Quarto Publish jobs: bookdown: name: GH-Pages From 2d0eb6241811d1159ab2e76a7dd509861506760b Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sun, 22 Sep 2024 16:40:44 +0200 Subject: [PATCH 05/10] minimize examppes --- _quarto.yml | 2 +- chapters/01-spatial-data.qmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/_quarto.yml b/_quarto.yml index dd101e5..ce47b2f 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -24,7 +24,7 @@ book: - chapters/02-attribute-operations.qmd - chapters/03-spatial-operations.qmd - chapters/04-geometry-operations.qmd - - chapters/05-raster-vector.qmd + #- chapters/05-raster-vector.qmd - chapters/06-reproj.qmd - chapters/07-read-write.qmd - chapters/08-mapping.qmd diff --git a/chapters/01-spatial-data.qmd b/chapters/01-spatial-data.qmd index 44af128..dac29fa 100644 --- a/chapters/01-spatial-data.qmd +++ b/chapters/01-spatial-data.qmd @@ -20,7 +20,7 @@ mkpath("output") ## Introduction ```{julia} using GeoDataFrames -df = GeoDataFrames.read("data/world.gpkg") +df = GeoDataFrames.read("../data/world.gpkg") ``` ```{julia} From b143ea5f793b236318081af8f03f8f19ca7e2650 Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sun, 22 Sep 2024 17:02:02 +0200 Subject: [PATCH 06/10] adds pr gha --- .github/workflows/main_new.yaml | 3 +- .github/workflows/pr.yaml | 64 +++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pr.yaml diff --git a/.github/workflows/main_new.yaml b/.github/workflows/main_new.yaml index 37300a2..de9bc80 100644 --- a/.github/workflows/main_new.yaml +++ b/.github/workflows/main_new.yaml @@ -3,10 +3,9 @@ on: push: branches: [main] - pull_request: name: Quarto Publish jobs: - bookdown: + quarto: name: GH-Pages runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..21f361c --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,64 @@ +on: + workflow_dispatch: + pull_request: + branches: + [main] +name: Quarto PR Publish +jobs: + bookdown: + name: GH-Pages + runs-on: ubuntu-latest + permissions: + contents: write + statuses: write + steps: + - uses: actions/checkout@v3 + - uses: julia-actions/setup-julia@v2 + - uses: julia-actions/cache@v2 + - name: Set up custom Julia dependencies + run: | + using Pkg + Pkg.activate("quarto"; shared = true) + # TODO: QuartoNotebookRunner does not support execute-dir yet, but this PR does. + Pkg.add(url = "https://github.com/asinghvi17/QuartoNotebookRunner.jl", rev = "as/execute-dir") + Pkg.instantiate() + Pkg.activate(".") + Pkg.add([ + # TODO: DimensionalData v0.28 is not compatible with Rasters latest version, + # and has Makie fixes that we need for the book, otherwise plotting errors out. + # These can be removed after Rasters.jl's new breaking version. + PackageSpec(url = "https://github.com/asinghvi17/Rasters.jl", rev = "as/dd28"), + PackageSpec(url = "https://github.com/rafaqz/DimensionalData.jl", rev = "main"), + ]) + shell: julia {0} + - uses: julia-actions/julia-buildpkg@v1 + + - name: Set up Quarto + uses: quarto-dev/quarto-actions/setup@v2 + env: + QUARTO_JULIA_PROJECT: "@quarto" + + - name: Render + uses: quarto-dev/quarto-actions/render@v2 + with: + to: html + + - name: Deploy Preview to Netlify as preview + id: netlify-deploy + uses: nwtgck/actions-netlify@v2 + env: + NETLIFY_SITE_ID: e18690e5-215e-4584-b0f1-963bc99a10d0 + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + with: + publish-dir: './_site' + production-deploy: false + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: + 'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})' + alias: deploy-preview-${{ github.event.number }} + # these all default to 'true' + enable-pull-request-comment: true + enable-commit-comment: false + enable-commit-status: true + overwrites-pull-request-comment: false + timeout-minutes: 1 \ No newline at end of file From 4665e3e1d92403c85bf4cee27352a6859137124c Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sun, 22 Sep 2024 17:05:18 +0200 Subject: [PATCH 07/10] fixes dir --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 21f361c..b8cd461 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -50,7 +50,7 @@ jobs: NETLIFY_SITE_ID: e18690e5-215e-4584-b0f1-963bc99a10d0 NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} with: - publish-dir: './_site' + publish-dir: './docs' production-deploy: false github-token: ${{ secrets.GITHUB_TOKEN }} deploy-message: From 97ecba46d06b21f0cfbf2345af9238e80607ed1b Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sun, 22 Sep 2024 17:34:55 +0200 Subject: [PATCH 08/10] updates gha pr --- .github/workflows/pr.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index b8cd461..16e2abe 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -45,7 +45,7 @@ jobs: - name: Deploy Preview to Netlify as preview id: netlify-deploy - uses: nwtgck/actions-netlify@v2 + uses: nwtgck/actions-netlify@v3 env: NETLIFY_SITE_ID: e18690e5-215e-4584-b0f1-963bc99a10d0 NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} @@ -53,9 +53,9 @@ jobs: publish-dir: './docs' production-deploy: false github-token: ${{ secrets.GITHUB_TOKEN }} - deploy-message: - 'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})' - alias: deploy-preview-${{ github.event.number }} + deploy-message: | + Deploy from GHA: ${{ github.event.pull_request.title || format('manual from PR {0}', github.event.issue.number) }} + alias: deploy-preview-${{ github.event.pull_request.number || github.event.issue.number }} # these all default to 'true' enable-pull-request-comment: true enable-commit-comment: false From 2622de9f708c8759e4f477de1f9e7cf562d6e620 Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sun, 22 Sep 2024 17:50:22 +0200 Subject: [PATCH 09/10] adds more permissions --- .github/workflows/pr.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 16e2abe..63a20f3 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -11,6 +11,7 @@ jobs: permissions: contents: write statuses: write + pull-requests: write steps: - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v2 From e0d39ed4c63f0d23eda044a29e7656bd66260666 Mon Sep 17 00:00:00 2001 From: Jakub Nowosad Date: Sun, 22 Sep 2024 18:03:41 +0200 Subject: [PATCH 10/10] fixes pr gha --- .github/workflows/pr.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 63a20f3..a32d6f1 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -12,6 +12,7 @@ jobs: contents: write statuses: write pull-requests: write + deployments: write steps: - uses: actions/checkout@v3 - uses: julia-actions/setup-julia@v2