From aac9a57e845fa59f515a5b7596b4b0aa92f52921 Mon Sep 17 00:00:00 2001 From: lgaliana Date: Thu, 17 Oct 2024 18:07:13 +0000 Subject: [PATCH] use example doc --- .github/workflows/bookdown-test.yaml | 29 ++++++++++++++++++---------- .github/workflows/prod.yaml | 29 ++++++++++++++++++---------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/.github/workflows/bookdown-test.yaml b/.github/workflows/bookdown-test.yaml index 004197e5..b691d899 100644 --- a/.github/workflows/bookdown-test.yaml +++ b/.github/workflows/bookdown-test.yaml @@ -24,18 +24,27 @@ jobs: - name: Configure safe repository run: | git config --global --add safe.directory /__w/utilitR/utilitR - - name: Cache packages - uses: actions/cache@v1 - with: - path: ${{ env.RENV_PATHS_ROOT }} - key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} - restore-keys: | - ${{ runner.os }}-renv- - - name: Restore packages + - name: Set RENV_PATHS_ROOT + shell: bash + run: | + echo "RENV_PATHS_ROOT=${{ runner.temp }}/renv" >> $GITHUB_ENV + - name: Install and activate renv + run: | + install.packages("renv") + renv::activate() shell: Rscript {0} + - name: Get R and OS version + id: get-version run: | - if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") - renv::restore() + cat("##[set-output name=os-version;]", sessionInfo()$running, "\n", sep = "") + cat("##[set-output name=r-version;]", R.Version()$version.string, sep = "") + shell: Rscript {0} + - name: Restore Renv package cache + uses: actions/cache@v4 + with: + path: ${{ env.RENV_PATHS_ROOT }} + key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ inputs.cache-version }}-${{ hashFiles('renv.lock') }} + restore-keys: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}- env: GITHUB_PAT: ${{ secrets.PAT }} - name: Render Book diff --git a/.github/workflows/prod.yaml b/.github/workflows/prod.yaml index 5bfe31da..ed45002b 100644 --- a/.github/workflows/prod.yaml +++ b/.github/workflows/prod.yaml @@ -63,18 +63,27 @@ jobs: - name: Configure safe repository run: | git config --global --add safe.directory /__w/utilitR/utilitR - - name: Cache packages - uses: actions/cache@v1 - with: - path: ${{ env.RENV_PATHS_ROOT }} - key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }} - restore-keys: | - ${{ runner.os }}-renv- - - name: Restore packages + - name: Set RENV_PATHS_ROOT + shell: bash + run: | + echo "RENV_PATHS_ROOT=${{ runner.temp }}/renv" >> $GITHUB_ENV + - name: Install and activate renv + run: | + install.packages("renv") + renv::activate() shell: Rscript {0} + - name: Get R and OS version + id: get-version run: | - if (!requireNamespace("renv", quietly = TRUE)) install.packages("renv") - renv::restore() + cat("##[set-output name=os-version;]", sessionInfo()$running, "\n", sep = "") + cat("##[set-output name=r-version;]", R.Version()$version.string, sep = "") + shell: Rscript {0} + - name: Restore Renv package cache + uses: actions/cache@v4 + with: + path: ${{ env.RENV_PATHS_ROOT }} + key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ inputs.cache-version }}-${{ hashFiles('renv.lock') }} + restore-keys: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}- env: GITHUB_PAT: ${{ secrets.PAT }} - name: Render Book