2019-07-01 22:19:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euxo pipefail
|
2019-06-26 02:24:28 +00:00
|
|
|
|
|
|
|
ROOT=$(
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
/bin/pwd
|
|
|
|
)
|
2019-07-01 22:19:26 +00:00
|
|
|
DIST="$ROOT/dist/"
|
2019-06-26 02:24:28 +00:00
|
|
|
PUBLISH_BRANCH=$1
|
2019-07-01 22:19:26 +00:00
|
|
|
VERSION=$(cat package.json | jq -r .version)
|
2019-06-26 02:24:28 +00:00
|
|
|
|
|
|
|
git fetch --all
|
2019-07-01 22:59:33 +00:00
|
|
|
git stash
|
|
|
|
|
2019-06-26 02:24:28 +00:00
|
|
|
git checkout $PUBLISH_BRANCH
|
|
|
|
git pull origin $PUBLISH_BRANCH
|
2019-07-01 22:59:33 +00:00
|
|
|
|
|
|
|
pushd "v/"
|
2019-06-27 23:45:07 +00:00
|
|
|
# If the folder already exists we want to repalce it
|
2019-06-26 03:46:51 +00:00
|
|
|
if [ -d $VERSION ]; then
|
|
|
|
rm -r $VERSION
|
2019-06-26 03:49:20 +00:00
|
|
|
fi
|
2019-06-27 23:45:07 +00:00
|
|
|
# Create new version folder out of dist/
|
2019-07-01 22:19:26 +00:00
|
|
|
mv -f $DIST $VERSION
|
|
|
|
git add $VERSION
|
|
|
|
git commit -q -m "Publish v$VERSION"
|
2019-06-26 03:35:06 +00:00
|
|
|
git push origin $PUBLISH_BRANCH
|
2019-07-01 22:59:33 +00:00
|
|
|
popd
|
|
|
|
|
2019-06-27 23:45:07 +00:00
|
|
|
git checkout -
|
2019-07-01 22:59:33 +00:00
|
|
|
|
|
|
|
git stash apply
|