Move default branch to main #83
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
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
workflow_dispatch: | |
name: bookdown | |
env: | |
isExtPR: ${{ github.event.pull_request.head.repo.fork == true }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::XML | |
- name: Build site | |
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)' | |
- name: Install npm | |
uses: actions/setup-node@v4 | |
- name: Deploy to Netlify | |
if: contains(env.isExtPR, 'false') | |
# NETLIFY_AUTH_TOKEN added in the repo's secrets | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
run: | | |
npm install netlify-cli -g | |
netlify deploy --prod --dir _book --message "Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})" |