diff --git a/package.json b/package.json index e9d8908..97413b7 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "docs": "vuepress dev docs", "docs:build": "vuepress build docs", "deploy": "sh deploy.sh", - "lint": "eslint --ext .js,.vue src" + "lint": "eslint --ext .js,.vue src", + "release": "sh ./release.sh" }, "dependencies": { "mpvue-citypicker": "^1.0.6", diff --git a/release.sh b/release.sh new file mode 100644 index 0000000..0c26fe3 --- /dev/null +++ b/release.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +set -e +echo "Enter release version: " +read VERSION + +read -p "Releasing $VERSION - are you sure? (y/n)" -n 1 -r +echo # (optional) move to a new line +if [[ $REPLY =~ ^[Yy]$ ]] +echo "Releasing $VERSION ..." +then + # build + VERSION=$VERSION npm run build + if [[ `git status --porcelain` ]]; + then + git add -A + git commit -am "build: release $VERSION" + fi + + # commit + npm version $VERSION --message "build: release $VERSION" + + # publish + git push origin refs/tags/v"$VERSION" + git push origin master + + npm publish --registry=https://registry.npmjs.org +fi