Skip to content

Commit

Permalink
Create basic Makefile to build and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenjanssens committed Jul 10, 2020
1 parent d568ff1 commit ca5dabd
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.PHONY: build-1e build-2e redirects live publish-draft publish-production
.SUFFIXES:

.ONESHELL:
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -e

build-1e: www/static/1e/index.html
build-2e: www/static/2e/index.html
redirects: www/static/_redirects


www/static/1e/index.html: book/1e/*.Rmd
cd book/1e && Rscript --vanilla -e 'bookdown::render_book("index.Rmd", encoding = "UTF-8")'


www/static/2e/index.html: book/2e/*.Rmd
cd book/2e && Rscript --vanilla -e 'bookdown::render_book("index.Rmd", encoding = "UTF-8", clean = FALSE)'


www/static/_redirects:
curl -sL datascienceatthecommandline.com/1e | \
grep -Eo 'href="(.*)\.html"' | \
grep -v 'index' | \
cut -d\" -f 2 | \
sort -n | \
uniq | \
sed -E "s|(.*)|/\1 /1e/\1|" > $@

live:
cd www && hugo server --disableFastRender

publish-draft:
(cd www && hugo) && netlify deploy --dir www/public

publish-production:
(cd www && hugo) && netlify deploy --prod --dir www/public

0 comments on commit ca5dabd

Please sign in to comment.