theme -> origin/master #94
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
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" |