-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (113 loc) · 3.66 KB
/
build-site.yaml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: '0 0 * * 0'
name: Build site
jobs:
render:
name: Build site
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Get Hugo version
id: hugo_vr
run: |
ver=$(cat .Rprofile | grep hugo.version | cut -d'"' -f2 )
echo ".Rprofile sets hugo version to $ver"
echo "hugo_v=${ver}" >> $GITHUB_ENV
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ env.hugo_v }}
extended: true
- name: Install npm dependencies
run: npm install
- name: Install Netlify CLI
if: github.event_name == 'pull_request'
run: brew install netlify-cli
- name: Setup R
if: github.ref == 'refs/heads/main'
uses: r-lib/actions/setup-r@v2
timeout-minutes: 60
- name: Setup pandoc
if: github.ref == 'refs/heads/main'
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: '2.12'
- name: Cache R packages
if: github.ref == 'refs/heads/main'
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: r-${{ hashFiles('DESCRIPTION') }}
- name: Install R packages
if: github.ref == 'refs/heads/main'
run: |
install.packages(c("dplyr", "ggplot2", "tidyr", "knitr",
"scholar", "vitae", "rorcid", "glue",
"stringr", "blogdown"),
Ncpus = 2)
shell: Rscript {0}
- name: Install tinytex
if: github.ref == 'refs/heads/main'
uses: r-lib/actions/setup-tinytex@v2
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Render about me & cv
if: github.ref == 'refs/heads/main'
run: |
blogdown::build_site(local = FALSE,
run_hugo = FALSE,
build_rmd = "content/about/_index.Rmd")
rmarkdown::render("content/about/resume/am_mowinckel_cv.Rmd")
shell: Rscript {0}
env:
ORCID_TOKEN: ${{ secrets.ORCID_TOKEN }}
- name: Build
run: |
if [[ '${{github.ref}}' == 'refs/heads/main' ]]; then
hugo -e production
else
hugo -b https://${{ github.sha }}--drmowinckels.netlify.app/
fi
- name: Deploy production 🚀
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: public
- name: Deploy to Netlify
if: github.event_name == 'pull_request'
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
echo "Running netlify preview deploy"
netlify deploy --alias ${{ github.sha }}
shell: sh
#
# - name: Send to rweekly
# if: github.event_name == 'push'
# run: |
# files=$(jack --name-only HEAD~30..HEAD content/blog/)
# Rscript R/rweekly.R files