Skip to content

Merge pull request #25 from fhdsl/MD-BEGONE #911

Merge pull request #25 from fhdsl/MD-BEGONE

Merge pull request #25 from fhdsl/MD-BEGONE #911

Workflow file for this run

# It was adapted by Candace Savonen for the OTTR_template https://github.com/jhudsl/OTTR_Template.
# This code was adapted by Carrie Wright to enable automated rendering of the site associated with this repository
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 6) (Sunday=0 or 7)
# | | | | |
# * * * * * command to be executed
name: Render html
on:
workflow_dispatch:
schedule:
- cron: "0 3 * * 0"
push:
branches:
- main
paths:
- '**.Rmd'
- collection.tsv
jobs:
build-collection:
name: Build Collection
uses: ./.github/workflows/build-collection.yml
with:
render-type: 'main'
repository: $GITHUB_REPOSITORY
secrets:
gh_pat: ${{ secrets.GH_PAT }}
render-main:
runs-on: ubuntu-latest
# install.packages("remotes") # in case we decide not to go with the container...
# remotes::install_cran("rmarkdown")
# remotes::install_deps(dependencies = TRUE)
needs: build-collection
container:
image: jhudsl/course_template
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout
uses: actions/checkout@v3
with:
# get the full repo
fetch-depth: 0
# use github PAT
token: ${{ secrets.GH_PAT }}
# We want a fresh run of the renders each time - so first delete old index.md file
- name: Delete old index.md
run: |
rm -f _pages/index.md
# Now we want to render Rmd -> md
# Requires a little bit of shuffling around of files.
- name: Convert Rmd to md
run: |
mv _pages/index.Rmd .
Rscript scripts/build.R
mv index.Rmd _pages/
mv index.md _pages/
# Commit the rendered site files - html files and site_libs files
- name: Commit rendered site files
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add . --force
git commit -m 'Render site' || echo "No changes to commit"
git pull --allow-unrelated-histories --strategy-option=ours
git push origin main || echo "No changes to push"