-
Notifications
You must be signed in to change notification settings - Fork 56
57 lines (48 loc) · 1.43 KB
/
deploy_main_preview.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
54
name: Rebuild and deploy dev version of book to gh-pages branch in dev/ folder
on:
push:
branches:
- main
paths:
- 'index.Rmd'
- '_bookdown.yml'
- '_output.yml'
- 'source/*.Rmd'
- 'source/*.bib'
- 'source/*.css'
- 'data/**'
- 'img/**'
- 'build_html.sh'
jobs:
deploy-main-preview:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Get Actions user id
id: get_uid
run: |
actions_user_id=`id -u $USER`
echo $actions_user_id
echo "uid=$actions_user_id" >> $GITHUB_OUTPUT
- name: checkout
uses: actions/checkout@v2
with:
ref: 'main'
- name: Build the book
run: |
./build_html.sh
- name: Reset ownership of workspace after build
uses: peter-murray/reset-workspace-ownership-action@v1
with:
user_id: ${{ steps.get_uid.outputs.uid }}
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/
keep_files: true
destination_dir: dev
# force_orphan: true # once peaceiris updates to v4, change this to true and keep_files: true for the PR / main branch deploy previews