Merge pull request #28 from brownag/dependabot/github_actions/actions… #98
This file contains hidden or 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
| # Workflow derived from https://github.com/r-lib/actions/tree/master/examples | |
| # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main, master] | |
| paths: | |
| - '**.Rd' | |
| - '**.Rmd' | |
| - '**.md' | |
| - '**pkgdown.yml' | |
| tags: ['*'] | |
| name: pkgdown | |
| permissions: | |
| contents: 'write' | |
| id-token: 'write' | |
| jobs: | |
| pkgdown: | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| GOOGLE_CLOUD_QUOTA_PROJECT: ${{ secrets.GCP_PROJECT_ID }} | |
| WIF_PROVIDER: ${{ secrets.WIF_PROVIDER }} | |
| GCP_SA_EMAIL: ${{ secrets.GCP_SA_EMAIL }} | |
| R_RGEEDIM_RUN_EXAMPLES: 'TRUE' | |
| R_RGEEDIM_PYTHON_ENVNAME: "r-rgeedim" | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: r-lib/actions/setup-pandoc@v2 | |
| - uses: r-lib/actions/setup-r@v2 | |
| with: | |
| use-public-rspm: true | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| architecture: 'x64' | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: any::pkgdown, local::., rstudio/reticulate | |
| needs: website | |
| - name: Install Python dependencies | |
| run: | | |
| reticulate::virtualenv_create("r-rgeedim") | |
| reticulate::virtualenv_install("r-rgeedim", "geedim") | |
| print(reticulate::py_config()) | |
| shell: Rscript {0} | |
| - name: Install terra from r-universe | |
| run: | | |
| install.packages('terra', repos='https://rspatial.r-universe.dev') | |
| shell: Rscript {0} | |
| - name: Authenticate to Google Cloud (WIF) | |
| uses: 'google-github-actions/auth@v3' | |
| with: | |
| workload_identity_provider: ${{ secrets.WIF_PROVIDER }} | |
| service_account: ${{ secrets.GCP_SA_EMAIL }} | |
| - name: Set up Google Application Credentials for rgeedim | |
| run: | | |
| creds_file <- Sys.getenv("GOOGLE_APPLICATION_CREDENTIALS") | |
| if (creds_file == "" || !file.exists(creds_file)) { | |
| stop("GOOGLE_APPLICATION_CREDENTIALS not set or file does not exist") | |
| } | |
| shell: Rscript {0} | |
| - name: Authenticate with Earth Engine | |
| run: | | |
| rgeedim::gd_authenticate(quiet = TRUE) | |
| rgeedim::gd_initialize(quiet = FALSE) | |
| if (rgeedim::gd_is_initialized()) { | |
| cat("Earth Engine successfully initialized!\n") | |
| } else { | |
| cat("Earth Engine failed to initialize.\n") | |
| } | |
| shell: Rscript {0} | |
| - name: Install package | |
| run: R CMD INSTALL . | |
| - name: Deploy package | |
| run: | | |
| git config --local user.name "$GITHUB_ACTOR" | |
| git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' |