diff --git a/build/git-release.sh b/build/git-release.sh new file mode 100644 index 00000000..2795b7a6 --- /dev/null +++ b/build/git-release.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh +git checkout dev + +if test -n "$(git status --porcelain)"; then + echo 'Unclean working tree. Commit or stash changes first.' >&2; + exit 128; +fi + +if ! git fetch --quiet 2>/dev/null; then + echo 'There was a problem fetching your branch. Run `git fetch` to see more...' >&2; + exit 128; +fi + +if test "0" != "$(git rev-list --count --left-only @'{u}'...HEAD)"; then + echo 'Remote history differ. Please pull changes.' >&2; + exit 128; +fi + +echo 'No conflicts.' >&2; diff --git a/build/release.sh b/build/release.sh index bfd1fb61..93ba423b 100644 --- a/build/release.sh +++ b/build/release.sh @@ -1,8 +1,4 @@ -git checkout dev -git pull eleme dev --rebase -git checkout master -git merge dev - +#!/usr/bin/env sh set -e echo "Enter release version: " read VERSION @@ -29,7 +25,11 @@ then npm version $VERSION --message "[release] $VERSION" # publish - git push eleme refs/tags/v$VERSION + git push eleme dev + git checkout master + git merge dev git push eleme master + git push eleme refs/tags/v$VERSION + npm publish fi diff --git a/package.json b/package.json index 0b9e15c2..b91149c7 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "dist:all": "node build/bin/build-all.js && npm run build:theme", "i18n": "node build/bin/i18n.js", "lint": "eslint src/**/* test/**/* packages/**/*.{js,vue} build/**/* --quiet", - "pub": "sh build/release.sh", + "pub": "sh build/git-release.sh && sh build/release.sh", "pub:all": "npm run dist:all && lerna publish", "test": "npm run lint && CI_ENV=/dev/ karma start test/unit/karma.conf.js --single-run", "test:watch": "karma start test/unit/karma.conf.js"