Clean up and build blog posts #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples | |
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
name: Build Hugo | |
jobs: | |
blogdown: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Install R packages | |
run: | | |
install.packages(c("rmarkdown", "blogdown")) | |
shell: Rscript {0} | |
- name: Install hugo | |
run: | | |
R -e 'blogdown::install_hugo(extended = TRUE, version = "0.81.0")' | |
- name: Build site | |
run: | | |
R -e 'blogdown::build_site(build_rmd = blogdown::filter_timestamp)' | |
- 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 | |
else | |
echo "Running netlify production deploy" | |
netlify deploy --prod | |
fi |