-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (44 loc) · 1.72 KB
/
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
50
51
52
53
54
55
name: Build & Publish
on:
push:
branches: [main]
workflow_dispatch:
pull_request:
# automatically cancel previous runs on the same PR
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre/67939898#67939898
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-22.04
steps:
# inspired by
# https://github.com/rstudio/ai-blog/blob/c07dff9c18859ba682ee112ed45c7c3115c86e71/.github/workflows/main.yml
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2
- name: Cache R Packages
uses: actions/cache@v3
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ hashFiles('.github/R-version') }}-${{ hashFiles('.github/pkg-versions.Rds') }}-${{ hashFiles('.github/pkg-deps.Rds') }}
restore-keys: ${{ hashFiles('.github/R-version') }}-
- name: Install blogdown
run: install.packages("blogdown")
shell: Rscript {0}
- name: Install hugo
run: blogdown::install_hugo(extended = TRUE, version = "0.111.3")
shell: Rscript {0}
- name: Blogdown build
run: blogdown::build_site(build_rmd = "newfile")
shell: Rscript {0}
- name: Deploy to Github Pages
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages # The branch the action should deploy to.
folder: public # The folder the action should deploy.
clean-exclude: ".nojekyll"