Skip to content

Instantly share code, notes, and snippets.

View matteodelucchi's full-sized avatar

Matteo Delucchi matteodelucchi

View GitHub Profile
@matteodelucchi
matteodelucchi / use_github_action-bookdown.R
Created September 29, 2020 19:23
use_github_action-bookdown
usethis::use_github_action(url = "https://raw.githubusercontent.com/ropenscilabs/actions_sandbox/master/.github/workflows/deploy_bookdown.yml")
@matteodelucchi
matteodelucchi / local-empty-gh-pages-branch.sh
Created September 29, 2020 19:19
local-empty-gh-pages-branch
# 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
@matteodelucchi
matteodelucchi / connect-to-github.sh
Last active September 29, 2020 19:03
connect-to-github
# Connect to Github Repo
git remote add [email protected]:<username>/<repository-name>.git
# Push to master
git push origin master
@matteodelucchi
matteodelucchi / git-and-github-for-bookdown-project.sh
Created September 29, 2020 16:52
Setup Bookdown project with git and github
# Remove files we don't need
rm .travis.yml DESCRIPTION Dockerfile _build.sh _deploy.sh now.json .gitignore
# create new .gitignore
echo "
# don't push local rendered files in master branch
_book/
_bookdown_files/
libs/
**/*.bib
@matteodelucchi
matteodelucchi / serve_book.R
Created September 29, 2020 16:40
serve_book.R
bookdown::serve_book()
@matteodelucchi
matteodelucchi / open-Rstudio-bookdown-demo.sh
Created September 29, 2020 16:37
open-Rstudio-bookdown-demo
cd testbookdown/bookdown-demo-master
rstudio bookdown-demo.Rproj
@matteodelucchi
matteodelucchi / devtoolsinstallbookdown.R
Created September 29, 2020 16:34
installbookdown_devtools
if (!requireNamespace("devtools")) install.packages('devtools')
devtools::install_github('rstudio/bookdown')
@matteodelucchi
matteodelucchi / installbookdown.sh
Last active September 29, 2020 16:33
installbookdown
# Make new project directory
mkdir testbookdown
cd testbookdown
# Download bookdown demo project
wget https://github.com/rstudio/bookdown-demo/archive/master.zip
# Unzip it in project directory
unzip master.zip
@matteodelucchi
matteodelucchi / deploy_bookdown.yml
Created September 29, 2020 16:05
deploy_bookdown.yml
on:
push:
branches:
- master
name: renderbook
jobs: