
- Build index.html at deploy time - Update corresponding documentation references - Since index.html is untracked, git add needs -f - Clarify gh-pages generated commit message - Improve Makefile dependencies related to website generation As discussed in #936, tracking the index.html causes makes PRs longer / noisier and causes extra merge conflicts. More importantly, it causes contributors to inadvertently edit the wrong file, which causes extra work (#949) or contributions to be lost (#898). Since there's no need for index.html in development (everything uses try.html) a logical solution is to generate and commit the index.html at deploy time. Recording compiled or generated files in a deploy commit is a reasonable practice for git-based deploys (Heroku, gh-pages, and others). The old version of this was slightly "unsafe" for my taste, in that it depended on the local copy of gh-pages (if it existed) and master. The new version just replaces gh-pages with master + the new commit. Closes #936. Fixes #954 (the PR).
82 lines
2.1 KiB
Makefile
82 lines
2.1 KiB
Makefile
all: website favicon test
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
ifeq ($(UNAME_S),Linux)
|
|
SED=sed -r
|
|
NEWLINE=$\n
|
|
endif
|
|
ifeq ($(UNAME_S),Darwin)
|
|
SED=sed -E
|
|
NEWLINE=$$'\n'
|
|
endif
|
|
|
|
favicon:
|
|
node gh-badge.js '' '' '#bada55' .png > favicon.png
|
|
|
|
website:
|
|
cat try.html | $(SED) "s,(<img src=')(/[^'\?]+)',\1https://img.shields.io\2?maxAge=2592000'," \
|
|
| $(SED) "s,(<img src=')(/[^'\?]+\?[^']+)',\1https://img.shields.io\2\&maxAge=2592000'," \
|
|
| $(SED) "s,<span id='imgUrlPrefix'>,&https://img.shields.io," \
|
|
| $(SED) "s,var origin = '';,var origin = 'https://img.shields.io';," \
|
|
| $(SED) "s,<style>,<!-- WARNING: THIS FILE WAS GENERATED FROM try.html -->\\"$(NEWLINE)"<style>," > index.html
|
|
|
|
deploy: deploy-s0 deploy-s1 deploy-s2 deploy-gh-pages
|
|
|
|
deploy-s0:
|
|
git add -f Verdana.ttf
|
|
git add -f private/secret.json
|
|
git commit -m'MUST NOT BE ON GITHUB'
|
|
git push -f s0 HEAD:master
|
|
git reset HEAD~1
|
|
git checkout master
|
|
|
|
deploy-s1:
|
|
git add -f Verdana.ttf
|
|
git add -f private/secret.json
|
|
git commit -m'MUST NOT BE ON GITHUB'
|
|
git push -f s1 HEAD:master
|
|
git reset HEAD~1
|
|
git checkout master
|
|
|
|
deploy-s2:
|
|
git add -f Verdana.ttf
|
|
git add -f private/secret.json
|
|
git commit -m'MUST NOT BE ON GITHUB'
|
|
git push -f s2 HEAD:master
|
|
git reset HEAD~1
|
|
git checkout master
|
|
|
|
deploy-gh-pages: website
|
|
(git checkout -B gh-pages master && \
|
|
git add -f index.html && \
|
|
git commit -m '[DEPLOY] Build index.html' && \
|
|
git push -f origin gh-pages:gh-pages) || git checkout master
|
|
git checkout master
|
|
|
|
deploy-heroku:
|
|
git add -f Verdana.ttf
|
|
git add -f private/secret.json
|
|
git commit -m'MUST NOT BE ON GITHUB'
|
|
git push -f heroku HEAD:master
|
|
git reset HEAD~1
|
|
(git checkout -B gh-pages && \
|
|
git merge master && \
|
|
git push -f origin gh-pages:gh-pages) || git checkout master
|
|
git checkout master
|
|
|
|
setup:
|
|
curl http://download.redis.io/releases/redis-2.8.8.tar.gz >redis.tar.gz \
|
|
&& tar xf redis.tar.gz \
|
|
&& rm redis.tar.gz \
|
|
&& mv redis-2.8.8 redis \
|
|
&& cd redis \
|
|
&& make
|
|
|
|
redis:
|
|
./redis/src/redis-server
|
|
|
|
test:
|
|
npm test
|
|
|
|
.PHONY: all favicon website deploy deploy-s0 deploy-s1 deploy-s2 deploy-gh-pages deploy-heroku setup redis test
|