Skip to content

Update website

Update website #503

Workflow file for this run

on:
pull_request:
branches:
- main
- master
push:
branches:
- master
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 "::set-output name=value::${ver}"
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: ${{ steps.hugo_vr.outputs.value }}
extended: true
- name: Install Netlify CLI
run: brew install netlify-cli
- name: Setup R
uses: r-lib/actions/setup-r@v2
timeout-minutes: 60
- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2
with:
pandoc-version: '2.12'
- name: Cache R packages
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: r-${{ hashFiles('DESCRIPTION') }}
- name: Install R packages
run: |
install.packages(c("dplyr", "ggplot2", "tidyr", "knitr",
"scholar", "vitae", "rorcid", "glue",
"stringr", "blogdown"),
Ncpus = 2)
shell: Rscript {0}
- name: Install tinytex
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: Install npm dependencies
run: npm install
- name: Alter base URL
if: github.event_name == 'pull_request'
run: |
sed 's/drmowinckels\.io/${{ github.sha }}--drmowinckels.netlify.app/g' config.toml > tmp
mv tmp config.toml
shell: sh
- name: Render about me & cv
if: github.event_name != 'pull_request'
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 site
run: hugo --enableGitInfo
shell: sh
- name: Deploy to Netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
echo "Running netlify preview deploy"
netlify deploy --alias ${{ github.sha }}
elif [[ ${{ github.event_name }} == 'push' ]]; then
echo "Running netlify production deploy"
netlify deploy --prod
else
echo "Nothing to send to netlify"
fi
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