Skip to content

Commit caa6104

Browse files
Merge pull request #582 from UBC-DSCI/no-rebuild-on-prod
Avoid rebuild on push to `production`; just use contents of `dev`
2 parents c8879f4 + ad78100 commit caa6104

File tree

2 files changed

+48
-78
lines changed

2 files changed

+48
-78
lines changed

.github/workflows/build_book.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

.github/workflows/update_book.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Rebuild and deploy book to gh-pages branch
2+
on:
3+
push:
4+
branches:
5+
- production
6+
paths:
7+
- 'index.Rmd'
8+
- '_bookdown.yml'
9+
- '_output.yml'
10+
- 'source/*.Rmd'
11+
- 'source/*.bib'
12+
- 'source/*.css'
13+
- 'data/**'
14+
- 'img/**'
15+
- 'build_html.sh'
16+
17+
jobs:
18+
deploy-book:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
packages: write
23+
24+
steps:
25+
- name: checkout gh-pages
26+
uses: actions/checkout@v2
27+
with:
28+
ref: 'gh-pages'
29+
30+
- name: Copy contents of dev/ to home folder
31+
run: |
32+
yes | cp -rf dev ${{ runner.home }}
33+
34+
# Push update website to dev/ and clean out old commits
35+
- name: Update website to contents of dev, remove all old commits and subpages
36+
uses: peaceiris/[email protected]
37+
with:
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
publish_dir: dev/
40+
force_orphan: true # this will clean up all previous PR previews / main branch preview
41+
cname: datasciencebook.ca
42+
43+
- name: copy dev/ website back in
44+
run: |
45+
yes | cp -rf ${{ runner.home }}/dev dev
46+
47+
- name: push the result to gh-pages
48+
uses: stefanzweifel/git-auto-commit-action@v5

0 commit comments

Comments
 (0)