Build Site to GitHub Pages branch #1230
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 Site to GitHub Pages branch | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 8 * * 0-6' | |
jobs: | |
build-site: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Install curl and sodium | |
shell: bash | |
run: | | |
sudo apt update | |
sudo apt-get install libcurl4-openssl-dev r-base | |
sudo apt-get install libsodium-dev | |
- name: Setup pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: '4.2.1' | |
- name: Setup renv | |
uses: r-lib/actions/setup-renv@v2 | |
- name: Update Google Sheets talks data with latest MeetUp data | |
env: | |
CYPHR_KEY: ${{ secrets.CYPHR_KEY }} | |
GSHEET_ID: ${{ secrets.GSHEET_ID }} | |
run: | | |
Rscript -e 'source("R/data/update-data.R")' | |
- name: Render site from Rmarkdown files | |
env: | |
CYPHR_KEY: ${{ secrets.CYPHR_KEY }} | |
GSHEET_ID: ${{ secrets.GSHEET_ID }} | |
run: | | |
Rscript -e 'rmarkdown::render_site(input = "${{ github.workspace }}")' | |
- name: Ensure tokens do not exist | |
run: | | |
rm ~/.Rprofile | |
- name: Deploy site to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_site |