Merge pull request #406 from CrossStream/sandbox/rzr/review/master

build: Add deploy upload rules
This commit is contained in:
Yujie Wen 2020-03-02 10:30:06 +08:00 committed by GitHub
commit dfaf3a4c9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 4 deletions

View File

@ -12,11 +12,12 @@ default: help all
srcs?=$(wildcard *.org | sort)
objs?=${srcs:.org=.html}
target?=$(shell echo ${srcs:.org=} | head -n1)
target?=$(shell echo ${srcs:.org=} | tr ' ' '\n' | head -n1)
reveal_url?=https://github.com/hakimel/reveal.js/
reveal_zip_url?=https://github.com/hakimel/reveal.js/archive/master.zip
reveal_dir?=./reveal.js
sudo?=sudo
deploy_branch?=gh-pages
help:
@ -26,6 +27,7 @@ help:
@echo "# make all # Build html"
@echo "# make start # View HTML in Web browser"
@echo "# make download # Download deps"
@echo "# make upload # to build and publish"
@echo "# make setup/debian setup download start # ..."
@echo "# Config:"
@echo "# srcs=${srcs}"
@ -36,6 +38,7 @@ all: ${objs}
ls $^
download: ${reveal_dir}
ls $^
start: ${target}.html
x-www-browser $<
@ -94,8 +97,8 @@ html: ${target}.html
all/%: ${srcs}
for src in $^ ; do \
dir=$$(dirname -- "$${src}") ; \
make target="$${dir}/index" ${@F} \
target=$$(echo "$${src}" | sed -e 's|\.org$$||g') ; \
make target="$${target}" "${@F}" \
|| exit $$? ; \
done
@ -104,4 +107,27 @@ ${reveal_dir}:
wget -O- ${reveal_zip_url} > reveal.js.zip
unzip reveal.js.zip
mv reveal.js-master ${@}
@rm -f tmp.zip
@rm -f reveal.js.zip
deploy:
-git commit -sam "WIP: About to deploy ${target}"
git checkout ${deploy_branch} \
|| git checkout -b ${deploy_branch} master
make html
git add -f ${target}.html
-git commit -am "WIP: Generated html ${target}"
git checkout master
upload:
git checkout master
-git branch -D ${deploy_branch}
git checkout -b ${deploy_branch}
-git commit -sam "WIP: About to download"
make download
git add -f "${reveal_dir}"
-git commit -sam "WIP: Add ${reveal_dir}"
${MAKE} all/deploy
git checkout ${deploy_branch}
echo "# About to push to origin in 5 secs ?"
sleep 5 ; git push -f origin HEAD:gh-pages
git checkout master