#!/bin/bash

git config --global url.ssh://git@github.com/.insteadOf https://github.com/
git config --global user.email "robot@example.com"
git config --global user.name "Codeship Robot"
git remote set-branches --add origin gh-pages
git fetch
git checkout gh-pages

git clone --depth 1 git@github.com:measurement-factory/functional-text-sandbox.git
cd functional-text-sandbox
SANDBOX_COMMIT=$(git rev-parse --verify master)

git clone --depth 1 git@github.com:measurement-factory/functional-text.git
cd functional-text
PARENT_COMMIT=$(git rev-parse --verify master)
cd ..

npm install
webpack
cp src/index.html deploy-result/index.html
cd ..

cp functional-text-sandbox/deploy-result/* ./
rm -rf functional-text-sandbox

if ! git diff-index --quiet HEAD --; then
    git add index.html bundle.js bundle.js.map
    git commit -m "Updating gh-pages branch. (with sandbox @ $SANDBOX_COMMIT, and functional text @ $PARENT_COMMIT) [skip ci]"
    git push
fi
#!/bin/bash

git config --global url.ssh://git@github.com/.insteadOf https://github.com/
git config --global user.email "robot@example.com"
git config --global user.name "Codeship Robot"

SANDBOX_COMMIT=$(git rev-parse --verify master)

git remote set-branches --add origin gh-pages
git fetch
git checkout -f gh-pages

git clone --depth 1 git@github.com:measurement-factory/functional-text-sandbox.git
cd functional-text-sandbox
git checkout -f $SANDBOX_COMMIT

git clone --depth 1 git@github.com:measurement-factory/functional-text.git
cd functional-text
PARENT_COMMIT=$(git rev-parse --verify master)
cd ..

npm install
cd node_modules/functional-text
make build-core # build into lib/ so that functional text can work.
cd ../.. # in functional-text-sandbox oncemore

webpack
cp src/index.html deploy-result/index.html
cd ..

cp functional-text-sandbox/deploy-result/* ./
rm -rf functional-text-sandbox

if ! git diff-index --quiet HEAD --; then
    git add index.html bundle.js bundle.js.map
    git commit -m "Updating gh-pages branch. (with sandbox @ $SANDBOX_COMMIT, and functional text @ $PARENT_COMMIT) [skip ci]"
    git push
fi
Change deployment to execute `make build-core` itself.
Change deployment to execute `make build-core` itself.
