website: Auto deplotment of the website.

MultiPart: 1/2
Change-Id: I9aa8853bdeae13f59086651d6bfe3abdecf9b159
diff --git a/Makefile b/Makefile
index 74ad1c0..3f2be1c 100644
--- a/Makefile
+++ b/Makefile
@@ -34,22 +34,14 @@
 #############################################################################
 # Tooling and infrastructure
 
-# Add node and npm to PATH. Note, we run npm using 'node npm' to avoid relying
+# Find nodejs and add it to PATH.
+NODE_BIN := $(shell jiri profile env --profiles=v23:base,v23:nodejs NODE_BIN=)
+export PATH := $(NODE_BIN):$(PATH)
+
+# Note, we run npm using 'node npm' to avoid relying
 # on the shebang line in the npm script, which can exceed the Linux shebang
 # length limit on Jenkins.
-NODE_BIN := $(shell jiri profile env --profiles=v23:base,v23:nodejs NODE_BIN=)
-# Once the JS tutorials stop running npm, we can simplify this to setting
-# npm := node $(NODE_BIN)/npm and using $(npm) in place of npm elsewhere
-# in this file.
-NPM_DIR := $(shell mktemp -d "/tmp/XXXXXX")
-export PATH := $(NPM_DIR):$(NODE_BIN):$(PATH)
-
-# SEE: https://www.gnu.org/software/make/manual/html_node/Chained-Rules.html
-npm = $(NPM_DIR)/npm
-.INTERMEDIATE: $(npm)
-$(npm):
-	echo 'node $(NODE_BIN)/npm "$$@"' > $(npm)
-	chmod +x $(npm)
+npm := node $(NODE_BIN)/npm
 
 # mdrip is a tool for extracting shell scripts from any markdown content which
 # might have code blocks in it (like the tutorials). The mdrip tool is also
@@ -60,8 +52,7 @@
 
 #############################################################################
 # Variables, functions, and helpers
-
-TMPDIR := $(shell mktemp -d "/tmp/XXXXXX")
+TMPDIR := $(shell mktemp -d "XXXXXX" --tmpdir=$(TMPDIR))
 HEAD := $(shell git rev-parse HEAD)
 
 bundles := public/css public/js/bundle.js
@@ -153,9 +144,9 @@
 all: build
 	@true
 
-node_modules: package.json | $(npm)
-	npm prune
-	npm install
+node_modules: package.json
+	$(npm) prune
+	$(npm) install
 	touch $@
 
 # NOTE(sadovsky): Some files under public/{css,js} were copied over from the
@@ -195,14 +186,22 @@
 	@echo "Watching for changes in $^"
 	@find $^ | entr $(MAKE) build
 
-# TODO(sadovsky): Check that we're in a clean master branch. Also, automate
-# deployment so that changes are picked up automatically.
+################################################################################
+# Note: deploy target is automatically triggered by Jenkins by the
+# 'vanadium-website-deploy' job after each successful build of the
+# 'vanadium-website-site' job.
+# If there are any changes, it commits and pushes to the vanadium.github.io
+# repository, which is served by GitHub pages.
 .PHONY: deploy
 deploy: clean build
 	git clone git@github.com:vanadium/vanadium.github.io.git $(TMPDIR)
 	rm -rf $(TMPDIR)/*
 	rsync -r build/* $(TMPDIR)
-	cd $(TMPDIR) && git add -A && git commit -m "pull $(HEAD)" && git push
+	cd $(TMPDIR) && \
+	git add -A && \
+	git diff-index --quiet HEAD || \
+	git commit -m "pull $(HEAD)" && \
+	git push
 
 .PHONY: clean
 clean:
diff --git a/README.md b/README.md
index 9f644d8..8468ce6 100644
--- a/README.md
+++ b/README.md
@@ -80,11 +80,9 @@
 
 ## Deployment
 
-The `make deploy` task deploys the website to GitHub Pages. Be sure to run this
-task from a clean master branch, and to run `jiri update` immediately before
-deploying to ensure that you aren't missing any upstream changes. We're working
-on setting up additional checks to avoid these pitfalls, along with an automatic
-deployment process.
+Jenkins [automatically](https://veyron.corp.google.com/jenkins/job/vanadium-website-deploy/)
+deploys to production on every successful build of
+[vanadium-website-site](https://veyron.corp.google.com/jenkins/job/vanadium-website-site/) target.
 
 [mustache]: http://mustache.github.io/
 [markdown]: https://daringfireball.net/projects/markdown/