publish #59
This file contains 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 | |
workflow_dispatch: | |
name: publish | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Config git actor | |
run: | | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Actions" | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
- name: Cache bookdown results | |
uses: actions/cache@v4 | |
with: | |
path: _bookdown_files | |
key: bookdown-${{ hashFiles('**/*Rmd') }} | |
restore-keys: bookdown- | |
- name: Render gitbook | |
run: | | |
bookdown::render_book('index.Rmd', 'bookdown::bs4_book') | |
shell: Rscript {0} | |
- name: Publish manual | |
run: | | |
git clone -b gh-pages https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git book-output | |
cd book-output | |
cp -r ../_book/* ./ | |
git add --all * | |
git commit -m "Update the book" || true | |
git push https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/${{github.repository}}.git gh-pages |