-
Notifications
You must be signed in to change notification settings - Fork 56
53 lines (46 loc) · 1.37 KB
/
update_book.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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 $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/actions-gh-pages@v3.8.0
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: checkout gh-pages again (to grab new orphaned upstream branch)
uses: actions/checkout@v2
with:
ref: 'gh-pages'
- name: copy dev/ website back in
run: |
yes | cp -rf $HOME/dev dev
- name: push the result to gh-pages
uses: stefanzweifel/git-auto-commit-action@v5