r4ds/.github/workflows/quarto-book-netlify.yaml

61 lines
1.6 KiB
YAML
Raw Normal View History

2020-10-03 21:26:36 +08:00
on:
push:
branches: main
2020-10-07 05:17:30 +08:00
pull_request:
branches: main
# to be able to trigger a manual build
2022-01-04 05:28:15 +08:00
workflow_dispatch:
2020-10-07 05:17:30 +08:00
schedule:
# run every day at 11 PM
- cron: '0 23 * * *'
2020-10-03 21:26:36 +08:00
name: Render and deploy Book to Netlify
2020-10-03 21:26:36 +08:00
2020-10-03 21:51:47 +08:00
env:
isExtPR: ${{ github.event.pull_request.head.repo.fork == true }}
2022-06-09 00:22:11 +08:00
RUST_BACKTRACE: 1
2020-10-03 21:51:47 +08:00
2020-10-03 21:26:36 +08:00
jobs:
build-deploy:
2022-01-04 05:28:15 +08:00
runs-on: ubuntu-latest
2020-10-03 21:26:36 +08:00
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
2022-01-04 05:28:15 +08:00
- uses: actions/checkout@v2
2020-10-03 21:26:36 +08:00
- name: Install Quarto
uses: quarto-dev/quarto-actions/install-quarto@v1
with:
# To install LaTeX to build PDF book
tinytex: true
# uncomment below and fill to pin a version
# version: 0.9.105
2020-10-03 21:26:36 +08:00
2022-01-04 05:28:15 +08:00
- uses: r-lib/actions/setup-r@v2
2020-10-03 21:26:36 +08:00
with:
2022-01-04 05:28:15 +08:00
use-public-rspm: true
2020-10-03 21:26:36 +08:00
2022-01-04 05:28:15 +08:00
- uses: r-lib/actions/setup-r-dependencies@v2
2020-10-03 21:26:36 +08:00
- name: Render book to all format
# Add any command line argument needed
2020-10-06 00:28:01 +08:00
run: |
quarto render
2020-10-03 21:26:36 +08:00
- name: Deploy to Netlify
2020-10-03 21:51:47 +08:00
if: contains(env.isExtPR, 'false')
id: netlify-deploy
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: './_book'
2021-12-08 22:17:42 +08:00
production-branch: main
2020-10-03 21:51:47 +08:00
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message:
'Deploy from GHA: ${{ github.event.pull_request.title || github.event.head_commit.message }} (${{ github.sha }})'
enable-pull-request-comment: false
enable-commit-comment: false
2020-10-03 21:26:36 +08:00
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
2021-02-05 05:23:41 +08:00
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_2E }}
2020-10-03 21:51:47 +08:00
timeout-minutes: 1