Deploy site and docs from CircleCI

- Add missing Circle workflow
- Automatically deploy tagged docs
- Deploy prod-npm build for site, should work now (latest
Closure-compiler fixes sliders with React)
This commit is contained in:
Juho Teperi 2018-04-16 19:50:32 +03:00
parent 7bacb01f78
commit 54f5e5842f
4 changed files with 63 additions and 20 deletions

24
build-docs.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
set -e
TAG=$CIRCLE_TAG
if [[ -z $TAG ]]; then
echo "Set CIRCLE_TAG"
exit 1
fi
lein codox
rm -fr tmp
git clone git@github.com:reagent-project/reagent-project.github.io.git tmp
mkdir -p "tmp/docs/$TAG/"
cp -r target/doc/* "tmp/docs/$TAG/"
cd tmp
git add .
git commit -m "Built docs from $TAG"
git push
rm -rf tmp

View File

@ -1,31 +1,23 @@
#!/bin/bash
set -ex
set -e
SHA=$(git rev-parse HEAD)
cd test-environments/browser-umd-react-16
lein 'do' clean, cljsbuild once prod-npm, cljsbuild once prerender
lein do clean, cljsbuild once prod
cd ../..
# Prerendering seems to work best on React 16
cd test-environments/browser-node-react-16
lein cljsbuild once prerender
node target/cljsbuild/prerender/main.js
cd ../..
lein codox
rm -fr tmp
git clone git@github.com:reagent-project/reagent-project.github.io.git tmp
# Remove everything to ensure old files are removed
rm -fr tmp/*
cp -r test-environments/browser-umd-react-16/target/cljsbuild/prod/public/* tmp/
cp -r test-environments/browser-node-react-16/target/prerender/public/* tmp/
cp -r target/cljsbuild/prod-npm/public/* tmp/
cp -r target/prerender/public/* tmp/
mkdir -p tmp/docs/master/
cp -r target/doc/* tmp/docs/master/
@ -34,7 +26,9 @@ test -f tmp/js/main.js
test ! -e tmp/js/out
cd tmp
git checkout -- README.md
# Restore files not created by this script
git checkout -- README.md docs/
git add .
git commit -m "Built site from $SHA"
git push

View File

@ -1,6 +1,6 @@
version: 2
jobs:
build:
test:
working_directory: ~/work
docker:
- image: circleci/clojure:lein-2.8.1-node-browsers
@ -27,7 +27,7 @@ jobs:
environment:
NPM_CONFIG_LOGLEVEL: warn
deploy_master:
update-site:
working_directory: ~/work
docker:
- image: circleci/clojure:lein-2.8.1
@ -36,4 +36,28 @@ jobs:
- add_ssh_keys
- deploy:
command: ./build-example-site.sh
update-tagged-docs:
working_directory: ~/work
docker:
- image: circleci/clojure:lein-2.8.1
steps:
- checkout
- add_ssh_keys
- deploy:
command: ./build-docs.sh
workflows:
version: 2
test-and-update-site:
jobs:
- test
- update-site:
requires: test
filters:
braches:
only:
- master
- update-tagged-docs:
requires: test
filters:
tags:
only: /.*/

View File

@ -96,7 +96,6 @@
{:source-paths ["src" "demo"]
:compiler {:main "sitetools.prerender"
:target :nodejs
:process-shim false
:output-dir "target/cljsbuild/prerender/out"
:output-to "target/cljsbuild/prerender/main.js"}}
@ -128,6 +127,7 @@
:elide-asserts true
:pretty-print false
;; :pseudo-names true
:stable-names true
:output-to "target/cljsbuild/prod/public/js/main.js"
:output-dir "target/cljsbuild/prod/out" ;; Outside of public, not published
:npm-deps false}}
@ -138,7 +138,8 @@
:optimizations :advanced
:elide-asserts true
:pretty-print false
:pseudo-names true
;; :pseudo-names true
:stable-names true
:output-to "target/cljsbuild/prod-npm/public/js/main.js"
:output-dir "target/cljsbuild/prod-npm/out" ;; Outside of public, not published
:process-shim true