Skip to content

Commit

Permalink
Merge pull request #582 from UBC-DSCI/no-rebuild-on-prod
Browse files Browse the repository at this point in the history
Avoid rebuild on push to `production`; just use contents of `dev`
  • Loading branch information
trevorcampbell authored Aug 21, 2024
2 parents c8879f4 + ad78100 commit caa6104
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 78 deletions.
78 changes: 0 additions & 78 deletions .github/workflows/build_book.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/update_book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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: Copy contents of dev/ to home folder
run: |
yes | cp -rf dev ${{ runner.home }}
# Push update website to dev/ and clean out old commits
- name: Update website to contents of dev, remove all old commits and subpages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dev/
force_orphan: true # this will clean up all previous PR previews / main branch preview
cname: datasciencebook.ca

- name: copy dev/ website back in
run: |
yes | cp -rf ${{ runner.home }}/dev dev
- name: push the result to gh-pages
uses: stefanzweifel/git-auto-commit-action@v5

0 comments on commit caa6104

Please sign in to comment.