Skip to content

Commit e03059e

Browse files
authored
Merge pull request #55 from ngs/deploy-test
Add .circleci to demo template
2 parents a95e6d6 + a0085a9 commit e03059e

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

.circleci/build-demo.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
NODE_ENV=production webpack --config demo/webpack.config.prod.js
6+
rm -rf demo/public/css
7+
cp -R demo/publicTemplate/* demo/public/

.circleci/deploy-demo.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
#!/bin/sh
3+
4+
set -eu
5+
6+
COMMIT=$(git rev-parse --short HEAD)
7+
BRANCH=gh-pages
8+
GIT_URL=$(git config --get remote.origin.url)
9+
DIR=.deploy
10+
11+
rm -rf $DIR
12+
13+
git clone $GIT_URL -b $BRANCH $DIR || (
14+
git init $DIR &&
15+
cd $DIR &&
16+
git remote add origin $GIT_URL &&
17+
git checkout -b $BRANCH
18+
)
19+
20+
rm -rf ${DIR}/*
21+
cp -R ${DIR}/../demo/public/* $DIR
22+
rm -rf ${DIR}/.circleci
23+
cp -R ${DIR}/../demo/publicTemplate/.circleci $DIR
24+
cd $DIR
25+
git add -A
26+
git commit -m "Built artifacts of ${COMMIT}"
27+
git push origin $BRANCH
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: 2
2+
3+
workflows:
4+
version: 2

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
"scripts": {
77
"eslint": "node_modules/.bin/eslint .",
88
"build": "npm run clean && npm run build:js",
9-
"build:demo":
10-
"NODE_ENV=production webpack --config demo/webpack.config.prod.js && rm -rf demo/public/css && cp -R demo/publicTemplate/* demo/public/",
9+
"build:demo": ".circleci/build-demo.sh",
1110
"build:js":
1211
"BABEL_DISABLE_CACHE=1 BABEL_ENV=production NODE_ENV=production node_modules/.bin/babel --out-dir='lib' --ignore='**/__test__/*' src",
1312
"clean":
1413
"node_modules/.bin/rimraf lib; node_modules/.bin/rimraf demo/public",
15-
"deploy:demo":
16-
"COMMIT=$(git rev-parse --short HEAD) && BRANCH=gh-pages && GIT_URL=$(git config --get remote.origin.url) && DIR=.deploy; rm -rf $DIR; (git clone $GIT_URL -b $BRANCH $DIR || (git init $DIR && cd $DIR && git remote add origin $GIT_URL && git checkout -b $BRANCH)) && rm -rf ${DIR}/* && cp -R ${DIR}/../demo/public/* $DIR && cd $DIR && git add -A && git commit -m \"Built artifacts of ${COMMIT}\" && git push origin $BRANCH",
14+
"deploy:demo": ".circleci/deploy-demo.sh",
1715
"prepublish": "npm run build",
1816
"start": "npm run start:dev",
1917
"start:dev": "node_modules/.bin/babel-node ./demo/server.js",

0 commit comments

Comments
 (0)