Skip to content

Commit

Permalink
All html slides converted to PDF as well.
Browse files Browse the repository at this point in the history
env var changes to workflow, google chrome added
  • Loading branch information
royfrancis committed Nov 6, 2020
1 parent 364d2b9 commit 4dc4fb9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install libxml2-dev libssl-dev libcurl4-openssl-dev libudunits2-dev libopenblas-base
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
rm -rf google-chrome-stable_current_amd64.deb
- name: Define variables
run: |
echo "::set-env name=path_repo::$(pwd)"
echo "::set-env name=path_export::$(grep -E '^output_dir' _site.yml | sed 's/^output_dir://' | xargs)"
echo "::set-env name=repo::$(echo "$GITHUB_REPOSITORY" | sed 's/.*\///')"
echo "path_repo=$(pwd)" >> $GITHUB_ENV
echo "path_export=$(grep -E '^output_dir' _site.yml | sed 's/^output_dir://' | xargs)" >> $GITHUB_ENV
echo "repo=$(echo $GITHUB_REPOSITORY | sed 's/.*\///')" >> $GITHUB_ENV
- name: Check R installation and variables
run: |
Rscript -e "print('R installation works!')"
Expand All @@ -34,8 +37,11 @@ jobs:
echo "Github repo: ${repo}"
echo "Path repo: ${path_repo}"
echo "Path export: ${path_export}"
echo "---------------------------------------------------------------------------------------------"
echo "Folder contents at $(pwd):"
ls -lh
echo "---------------------------------------------------------------------------------------------"
printenv
- name: Print R packages
run: |
# parse r packages from Rmd amd md files
Expand All @@ -52,7 +58,7 @@ jobs:
- name: Install R dependencies
if: steps.cache-rp.outputs.cache-hit != 'true'
run: |
Rscript -e 'install.packages("yaml")'
Rscript -e 'install.packages(c("yaml","pagedown"))'
Rscript -e 'if(!is.null(yaml::read_yaml("_site.yml")$packages$packages_cran_repo)) install.packages(yaml::read_yaml("_site.yml")$packages$packages_cran_repo)'
Rscript -e 'if(!is.null(yaml::read_yaml("_site.yml")$packages$packages_cran_student)) install.packages(yaml::read_yaml("_site.yml")$packages$packages_cran_student)'
Rscript -e 'if(!is.null(yaml::read_yaml("_site.yml")$packages$packages_bioc_repo)) BiocManager::install(as.character(yaml::read_yaml("_site.yml")$packages$packages_bioc_repo))'
Expand All @@ -70,6 +76,13 @@ jobs:
# Render website
Rscript -e "rmarkdown::render_site()"
# Generate PDFs
cd ${path_export}
Rscript -e "l <- list.files('.',pattern='slide.+html');if(length(l)!=0) {for(i in 1:length(l)) pagedown::chrome_print(l[i])};"
cd ..
# List folder contents
echo "Folder contents at $(pwd):"
ls -lh
echo "Folder contents at ${path_repo}/${path_export}:"
Expand Down
1 change: 1 addition & 0 deletions _site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ packages:
- knitr
- leaflet
- markdown
- pagedown
- remotes
- rmarkdown
- vioplot
Expand Down

0 comments on commit 4dc4fb9

Please sign in to comment.