-
Notifications
You must be signed in to change notification settings - Fork 14
49 lines (44 loc) · 1.39 KB
/
bookdown-build.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
name: Build Bookdown With Docker Image
on:
workflow_call:
inputs:
r_version:
required: true
type: string
jobs:
get-image-repository:
name: Get image repository
runs-on: ubuntu-latest
outputs:
image_repository: ${{ steps.lower_repo.outputs.image_repository }}
steps:
- id : lower_repo
name: set lower case repo name (Bug when repository is in UPPERCASE)
run: echo "::set-output name=image_repository::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')"
bookdown:
name: Build and upload bookdown site as artifact
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
needs: get-image-repository
container: ghcr.io/${{ needs.get-image-repository.outputs.image_repository }}-${{ inputs.r_version }}:latest
steps:
- uses: actions/checkout@v2
- name: Restore packages
shell: Rscript {0}
run: |
renv::restore()
- name: Cache bookdown results
uses: actions/cache@v2
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-
- name: Build site
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: site-${{ github.sha }}
path: _book/
retention-days: 3