diff --git a/package.json b/package.json index c6ba3d6b..c30cf378 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,9 @@ "unpkg": "./dist/twemoji.min.js", "scripts": { "build": "./scripts/generate", + "deploy": "./scripts/deploy.sh gh-pages", "test": "phantomjs ./src/test/testrunner.js", - "prepublishOnly": "run-s build test", - "postpublish": "./scripts/deploy.sh gh-pages" + "prepublishOnly": "run-s build test deploy" }, "dependencies": { "fs-extra": "^8.0.1", diff --git a/scripts/deploy.sh b/scripts/deploy.sh index d92b09c9..ba7b77c9 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -10,9 +10,12 @@ PUBLISH_BRANCH=$1 VERSION=$(cat package.json | jq -r .version) git fetch --all +git stash + git checkout $PUBLISH_BRANCH git pull origin $PUBLISH_BRANCH -cd "v/" + +pushd "v/" # If the folder already exists we want to repalce it if [ -d $VERSION ]; then rm -r $VERSION @@ -22,6 +25,8 @@ mv -f $DIST $VERSION git add $VERSION git commit -q -m "Publish v$VERSION" git push origin $PUBLISH_BRANCH -# Return to your working branch +popd + git checkout - -cd $ROOT \ No newline at end of file + +git stash apply