From cb025f9f1eafc90eed16b9ad81111c702295b16c Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Mon, 30 Jun 2014 16:24:51 -0700 Subject: [PATCH 1/2] Enabling travis, partly --- .travis.yml | 2 ++ Makefile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3a423a8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,2 @@ +language: python +script: make ghpages diff --git a/Makefile b/Makefile index f175f43..e14d022 100644 --- a/Makefile +++ b/Makefile @@ -13,3 +13,50 @@ screenshare.orig.txt: screenshare.orig.html screenshare.diff.html: screenshare.orig.txt screenshare.txt htmlwdiff screenshare.orig.txt screenshare.txt > screenshare.diff.html + +index.html: screenshare.html + cp -f $< $@ + +GHPAGES_TMP := /tmp/ghpages$(shell echo $$$$) +.TRANSIENT: $(GHPAGES_TMP) +ifeq (,$(TRAVIS_COMMIT)) +GIT_ORIG := $(shell git branch | grep '*' | cut -c 3-) +else +GIT_ORIG := $(TRAVIS_COMMIT) +endif + +# Only run upload if we are local or on the master branch +IS_LOCAL := $(if $(TRAVIS),,true) +ifeq (master,$(TRAVIS_BRANCH)) +IS_MASTER := $(findstring false,$(TRAVIS_PULL_REQUEST)) +else +IS_MASTER := +endif + +ghpages: index.html screenshare.js screenshare.css +ifneq (,$(or $(IS_LOCAL),$(IS_MASTER))) + mkdir $(GHPAGES_TMP) + cp -f $^ $(GHPAGES_TMP) + git clean -qfdX +ifeq (true,$(TRAVIS)) + git config user.email "ci-bot@example.com" + git config user.name "Travis CI Bot" + git checkout -q --orphan gh-pages + git rm -qr --cached . + git clean -qfdX + git pull -qf origin gh-pages --depth=5 +else + git checkout gh-pages + git pull +endif + mv -f $(GHPAGES_TMP)/* $(CURDIR) + git add $^ + if test `git status -s | wc -l` -gt 0; then git commit -m "Script updating gh-pages."; fi +ifneq (,$(GH_TOKEN)) + @echo git push https://github.com/$(TRAVIS_REPO_SLUG).git gh-pages + @git push https://$(GH_TOKEN)@github.com/$(TRAVIS_REPO_SLUG).git gh-pages +endif + -git checkout -qf "$(GIT_ORIG)" + -rm -rf $(GHPAGES_TMP) +endif + From 5d4c356edb162b5fa71ebf9e6c2df8f2e1dad36b Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Tue, 1 Jul 2014 09:53:22 -0700 Subject: [PATCH 2/2] Adding index.html to ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fb7610c..d4685e0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ screenshare.diff.html screenshare.orig.html screenshare.orig.txt screenshare.txt +index.html