website: add simple, manual `make deploy` rule
In the future we'll make deployment safer and more automatic.
Change-Id: I0e34b6c47543cd4ef3a3fc175256ff03f5a1356c
diff --git a/Makefile b/Makefile
index bf6ef49..7e1402b 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,10 @@
PATH := node_modules/.bin:$(PATH)
MDRIP ?= $(JIRI_ROOT)/third_party/go/bin/mdrip
+# Add node/npm to PATH.
+NODE_DIR := $(shell jiri v23-profile list --info Target.InstallationDir nodejs)
+export PATH := $(NODE_DIR)/bin:$(PATH)
+
# TODO(sadovsky):
# - Add "site-test" unit tests
# - "identity" subdir (needed by identity service?)
@@ -29,6 +33,8 @@
cp node_modules/material-design-lite/material*css* public/css
cp node_modules/material-design-lite/material*js* public/js
+# NOTE(sadovsky): Newer versions of postcss-cli and autoprefixer use JavaScript
+# Promises, which doesn't work with Vanadium's old version of node, 0.10.24.
public/css/bundle.css: $(shell find stylesheets) node_modules
lessc -sm=on stylesheets/index.less | postcss -u autoprefixer > $@
@@ -36,7 +42,7 @@
$(call BROWSERIFY,$<,$@)
################################################################################
-# Build and serve
+# Build, serve, and deploy
build: $(MDRIP) node_modules hljs mdl public/css/bundle.css public/js/bundle.js gen-scripts
haiku build --helpers helpers.js --build-dir $@
@@ -45,6 +51,18 @@
serve: build
@static build -H '{"Cache-Control": "no-cache, must-revalidate"}'
+TMPDIR := $(shell mktemp -d "/tmp/XXXXXX")
+HEAD := $(shell git rev-parse HEAD)
+
+# TODO(sadovsky): Check that we're in a clean master branch. Also, automate
+# deployment so that changes are picked up automatically.
+.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
+
################################################################################
# Clean and lint
diff --git a/package.json b/package.json
index 0d51590..068eecc 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
"material-design-lite": "^1.0.6"
},
"devDependencies": {
- "autoprefixer": "^6.3.1",
+ "autoprefixer": "^5.2.0",
"browserify": "^13.0.0",
"browserify-shim": "^3.8.12",
"haiku": "^0.2.13",
@@ -26,6 +26,6 @@
"less": "^2.5.3",
"marked": "^0.3.5",
"node-static": "^0.7.7",
- "postcss-cli": "^2.4.0"
+ "postcss-cli": "^1.4.0"
}
}