-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #582 from UBC-DSCI/no-rebuild-on-prod
Avoid rebuild on push to `production`; just use contents of `dev`
- Loading branch information
Showing
2 changed files
with
48 additions
and
78 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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 |