From 7787be9df1b65c7050255286896eefece20232f7 Mon Sep 17 00:00:00 2001 From: Brandon Beltz - NOAA Affiliate <136381970+BBeltz1@users.noreply.github.com> Date: Fri, 8 Mar 2024 16:43:10 -0500 Subject: [PATCH] rewrite build book workflow rewrote build book workflow to match workflow used when building catalog --- .github/workflows/bookdown.yaml | 65 +++++++++++++-------------------- 1 file changed, 25 insertions(+), 40 deletions(-) diff --git a/.github/workflows/bookdown.yaml b/.github/workflows/bookdown.yaml index 1a8a2466..353c764a 100644 --- a/.github/workflows/bookdown.yaml +++ b/.github/workflows/bookdown.yaml @@ -1,59 +1,44 @@ +# build Bookdown + on: push: branches: - - master - - brandon_url_changes + - master + - brandon_url_changes + + pull_request: + branches: + - master + -name: bookdown +name: build-book + +env: + isExtPR: ${{ github.event.pull_request.head.repo.fork == true }} jobs: build: - runs-on: ubuntu-latest env: - GITHUB_PAT: ${{ secrets.GH_PAT }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + runs-on: ubuntu-latest steps: - - name: Checkout repo - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - name: Setup R - uses: r-lib/actions/setup-r@v2 - - - name: Install libcurl - run: | - sudo apt-get install libgdal-dev libcurl4-gnutls-dev libgit2-dev libudunits2-dev + - uses: r-lib/actions/setup-pandoc@v2 - - name: Install Pandoc - #if: ${{ ! github.event.inputs.ghpages }} - uses: r-lib/actions/setup-pandoc@v2 + - uses: r-lib/actions/setup-r@v2 with: - pandoc-version: '2.17.1.1' + use-public-rspm: true - - name: Cache Renv packages - uses: actions/cache@v1 - with: - path: $HOME/.local/share/renv - key: r-${{ hashFiles('renv.lock') }} - restore-keys: r- + - uses: r-lib/actions/setup-r-dependencies@v2 - - name: Cache bookdown results - uses: actions/cache@v1 - with: - path: _bookdown_files - key: bookdown-${{ hashFiles('**/*Rmd') }} - restore-keys: bookdown- - - - name: Install packages - run: | - R -e 'install.packages("renv")' - R -e 'renv::restore()' - - - name: Build site + - name: Build book run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)' - + - name: Deploy to gh-pages - uses: JamesIves/github-pages-deploy-action@4.1.1 + uses: JamesIves/github-pages-deploy-action@v4 with: - GITHUB_TOKEN: ${{ secrets.GH_PAT }} + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} BRANCH: gh-pages # The branch the action should deploy to. FOLDER: _book # The folder the action should deploy. - CLEAN: true # Automatically remove deleted files from the deploy branch + CLEAN: true # Automatically remove deleted files from the deploy branch \ No newline at end of file