From 943e5c242b6c3a8cc92478dc95aba0a5b4b49588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Andr=C3=A8s?= Date: Thu, 22 Mar 2018 14:02:40 +0000 Subject: [PATCH] workflow: clean shell scripts (#7826) --- scripts/release-weex.sh | 18 ++++++++++-------- scripts/release.sh | 24 +++++++++++++----------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/scripts/release-weex.sh b/scripts/release-weex.sh index 3bb5412d..f7319777 100644 --- a/scripts/release-weex.sh +++ b/scripts/release-weex.sh @@ -1,6 +1,7 @@ +#!/bin/bash set -e -CUR_VERSION=`node build/get-weex-version.js -c` -NEXT_VERSION=`node build/get-weex-version.js` +CUR_VERSION=$(node build/get-weex-version.js -c) +NEXT_VERSION=$(node build/get-weex-version.js) echo "Current: $CUR_VERSION" read -p "Enter new version ($NEXT_VERSION): " -n 1 -r @@ -20,15 +21,16 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then WEEX_VERSION=$NEXT_VERSION npm run build:weex # update package - cd packages/weex-vue-framework - npm version $NEXT_VERSION + # using subshells to avoid having to cd back + ( cd packages/weex-vue-framework + npm version "$NEXT_VERSION" npm publish - cd - + ) - cd packages/weex-template-compiler - npm version $NEXT_VERSION + ( cd packages/weex-template-compiler + npm version "$NEXT_VERSION" npm publish - cd - + ) # commit git add packages/weex* diff --git a/scripts/release.sh b/scripts/release.sh index 6592fd40..71ebf840 100644 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,8 +1,9 @@ +#!/bin/bash set -e if [[ -z $1 ]]; then echo "Enter new version: " - read VERSION + read -r VERSION else VERSION=$1 fi @@ -32,23 +33,24 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then VERSION=$VERSION npm run build # update packages - cd packages/vue-template-compiler - npm version $VERSION + # using subshells to avoid having to cd back + ( ( cd packages/vue-template-compiler + npm version "$VERSION" if [[ -z $RELEASE_TAG ]]; then npm publish else - npm publish --tag $RELEASE_TAG + npm publish --tag "$RELEASE_TAG" fi - cd - + ) cd packages/vue-server-renderer - npm version $VERSION + npm version "$VERSION" if [[ -z $RELEASE_TAG ]]; then npm publish else - npm publish --tag $RELEASE_TAG + npm publish --tag "$RELEASE_TAG" fi - cd - + ) # commit git add -A @@ -63,14 +65,14 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then # generate release note npm run release:note # tag version - npm version $VERSION --message "build: release $VERSION" + npm version "$VERSION" --message "build: release $VERSION" # publish - git push origin refs/tags/v$VERSION + git push origin refs/tags/v"$VERSION" git push if [[ -z $RELEASE_TAG ]]; then npm publish else - npm publish --tag $RELEASE_TAG + npm publish --tag "$RELEASE_TAG" fi fi