Skip to content

Still working on github actions to deploy #131

Still working on github actions to deploy

Still working on github actions to deploy #131

Workflow file for this run

on:
push:
branches:
- main
name: renderbook
jobs:
bookdown:
name: Render-Book
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Install pandoc
run: |
brew install pandoc
- name: Cache Renv packages
uses: actions/cache@v2
with:
path: $HOME/.local/share/renv
key: r-${{ hashFiles('renv.lock') }}
restore-keys: r-
- name: Cache bookdown results
uses: actions/cache@v2
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-
- name: "[Custom block] [Linux] Install spatial libraries"
if: runner.os == 'Linux'
run: sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev
# - name: "[Custom block] [macOS] Install spatial libraries"
# if: runner.os == 'macOS'
# run: |
# # conflicts with gfortran from r-lib/actions when linking gcc
# rm '/usr/local/bin/gfortran'
# brew install pkg-config gdal proj geos
- name: Install packages
# The order of running the packages matters. For instance, placing `remotes` after `install_github` will lead to an error
run: |
R -e 'install.packages("bookdown")'
R -e 'install.packages("curl")'
R -e 'install.packages("deldir")'
R -e 'install.packages("cartogram")'
R -e 'install.packages("crosstalk")'
R -e 'install.packages("geosphere")'
R -e 'install.packages("ggmap")'
R -e 'install.packages("gh")'
R -e 'install.packages("gridExtra")'
R -e 'install.packages("gstat")'
R -e 'install.packages("kableExtra")'
R -e 'install.packages("leaflet")'
R -e 'install.packages("leaflet.extras")'
R -e 'install.packages("maptools")'
R -e 'install.packages("nngeo")'
R -e 'install.packages("plotly")'
R -e 'install.packages("readr")'
R -e 'install.packages("remotes")'
R -e 'install.packages("renv")'
R -e 'install.packages("rgdal")'
R -e 'install.packages("patchwork")'
R -e 'install.packages("sf")'
R -e 'install.packages("spatialreg")'
R -e 'install.packages("spatstat")'
R -e 'install.packages("spdep")'
R -e 'install.packages("spgwr")'
R -e 'install.packages("stars")'
R -e 'install.packages("tidyverse")'
R -e 'install.packages("vcdExtra")'
R -e 'renv::restore()'
R -e 'remotes::install_github("paezha/isdas")'
- name: Build site
run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'
- uses: actions/upload-artifact@v1
with:
name: _book
path: _book/
# Need to first create an empty gh-pages branch
# This workflow is partially based on this: https://medium.com/@delucmat/how-to-publish-bookdown-projects-with-github-actions-on-github-pages-6e6aecc7331e
# But it uses a newer version of Cecilapp/GitHub-Pages-deploy
# # Make a new branch with no parents and disconnected from all other branches
# git checkout --orphan gh-pages
# # Remove all files from the working tree
# git rm -rf .
# # Make an empty commit
# git commit --allow-empty -m 'Initial gh-pages commit'
# # Pushing to remote will create gh-pages branch on the remote repo
# git push origin gh-pages
# git checkout main
checkout-and-deploy:
runs-on: ubuntu-latest
needs: bookdown
steps:
- name: Checkout
uses: actions/checkout@master
- name: Download artifact
uses: actions/download-artifact@v1.0.0
with:
# Artifact name
name: _book # optional
# Destination path
path: _book # optional
- name: GH Pages deploy
uses: Cecilapp/GitHub-Pages-deploy@3.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
email: paezha@gmail.com
build_dir: _book # "_site/" by default
# on:
# push:
# branches:
# - main
# - master
#
# name: bookdown
#
# jobs:
# build:
# runs-on: macOS-latest
# env:
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# steps:
# - name: Checkout repo
# uses: actions/checkout@v2
#
# - name: Setup R
# uses: r-lib/actions/setup-r@v1
#
# - name: Install pandoc
# run: |
# brew install pandoc
#
# - name: Cache Renv packages
# uses: actions/cache@v2
# with:
# path: $HOME/.local/share/renv
# key: r-${{ hashFiles('renv.lock') }}
# restore-keys: r-
#
# - name: Cache bookdown results
# uses: actions/cache@v2
# with:
# path: _bookdown_files
# key: bookdown-${{ hashFiles('**/*Rmd') }}
# restore-keys: bookdown-
#
# - name: "[Custom block] [Linux] Install spatial libraries"
# if: runner.os == 'Linux'
# run: sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev
#
# - name: "[Custom block] [macOS] Install spatial libraries"
# if: runner.os == 'macOS'
# run: |
# # conflicts with gfortran from r-lib/actions when linking gcc
# rm '/usr/local/bin/gfortran'
# brew install pkg-config gdal proj geos
#
# - name: Install packages
# # The order of running the packages matters. For instance, placing `remotes` after `install_github` will lead to an error
#
# run: |
#
# R -e 'install.packages("bookdown")'
# R -e 'install.packages("curl")'
# R -e 'install.packages("deldir")'
# R -e 'install.packages("cartogram")'
# R -e 'install.packages("crosstalk")'
# R -e 'install.packages("geosphere")'
# R -e 'install.packages("ggmap")'
# R -e 'install.packages("gh")'
# R -e 'install.packages("gridExtra")'
# R -e 'install.packages("gstat")'
# R -e 'install.packages("kableExtra")'
# R -e 'install.packages("leaflet")'
# R -e 'install.packages("leaflet.extras")'
# R -e 'install.packages("maptools")'
# R -e 'install.packages("plotly")'
# R -e 'install.packages("readr")'
# R -e 'install.packages("remotes")'
# R -e 'install.packages("renv")'
# R -e 'install.packages("rgdal")'
# R -e 'install.packages("patchwork")'
# R -e 'install.packages("sf")'
# R -e 'install.packages("spatialreg")'
# R -e 'install.packages("spatstat")'
# R -e 'install.packages("spdep")'
# R -e 'install.packages("spgwr")'
# R -e 'install.packages("stars")'
# R -e 'install.packages("tidyverse")'
# R -e 'install.packages("vcdExtra")'
# R -e 'renv::restore()'
# R -e 'remotes::install_github("paezha/geog4ga3")'
#
# - name: Build site
# run: Rscript -e 'bookdown::render_book("index.Rmd", quiet = TRUE)'
# - uses: actions/upload-artifact@v1
# with:
# name: _book
# path: _book/
#
#
#
# # Need to first create an empty gh-pages branch
# # see https://pkgdown.r-lib.org/reference/deploy_site_github.html
# # and also add secrets for a GH_PAT and EMAIL to the repository
# # gh-action from Cecilapp/GitHub-Pages-deploy
# checkout-and-deploy:
# runs-on: ubuntu-latest
# needs: bookdown
# steps:
# - name: Checkout
# uses: actions/checkout@master
# - name: Download artifact
# uses: actions/download-artifact@v1.0.0
# with:
# # Artifact name
# name: _book # optional
# # Destination path
# path: _book # optional
# - name: Deploy to GitHub Pages
# uses: Cecilapp/GitHub-Pages-deploy@master
# env:
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# with:
# email: paezha@gmail.com
# jekyll: no
# build_dir: _book # https://github.com/settings/tokens
#
# #- name: Install npm
# # uses: actions/setup-node@v1
#
# #- name: Deploy to Netlify
# # NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID added in the repo's secrets
# # env:
# # NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# # NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# # run: |
# # npm install netlify-cli -g
# # netlify deploy --prod --dir _book