Merge pull request #591 from UBC-DSCI/main #7
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
name: Rebuild and deploy book to gh-pages branch | |
on: | |
push: | |
branches: | |
- production | |
paths: | |
- 'index.Rmd' | |
- '_bookdown.yml' | |
- '_output.yml' | |
- 'source/*.Rmd' | |
- 'source/*.bib' | |
- 'source/*.css' | |
- 'data/**' | |
- 'img/**' | |
- 'build_html.sh' | |
jobs: | |
deploy-book: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: checkout gh-pages | |
uses: actions/checkout@v2 | |
with: | |
ref: 'gh-pages' | |
- name: Clean the site contents except for dev, pull contents of dev/ to main site | |
run: | | |
# delete everything except the dev and .git folders | |
find . -maxdepth 1 ! -name ".git" ! -name "dev" ! -name "." | xargs rm -rf | |
# copy the contents of dev into the root | |
cp -rf dev/* . | |
# Push updated website, clean out old commits | |
- name: Update website | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./ | |
force_orphan: true | |
cname: datasciencebook.ca |