1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-12-26 00:15:54 +00:00
twemoji/scripts/deploy.sh

40 lines
612 B
Bash
Raw Normal View History

2019-07-01 22:19:26 +00:00
#!/bin/bash
set -euxo pipefail
ROOT=$(
cd $(dirname $0)/..
/bin/pwd
)
2019-07-01 22:19:26 +00:00
DIST="$ROOT/dist/"
PUBLISH_BRANCH=$1
2019-07-01 22:19:26 +00:00
VERSION=$(cat package.json | jq -r .version)
git fetch --all
git stash
git checkout $PUBLISH_BRANCH
git pull origin $PUBLISH_BRANCH
pushd "v/"
2019-06-27 23:45:07 +00:00
# If the folder already exists we want to repalce it
if [ -d $VERSION ]; then
rm -r $VERSION
2019-06-26 03:49:20 +00:00
fi
cp -r $DIST $VERSION
2019-07-01 22:19:26 +00:00
git add $VERSION
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
rm latest
ln -s $VERSION latest
git add latest
fi
2019-07-01 22:19:26 +00:00
git commit -q -m "Publish v$VERSION"
git push origin $PUBLISH_BRANCH
popd
2019-06-27 23:45:07 +00:00
git checkout -
git stash apply