Skip to content

Commit

Permalink
workflow: clean shell scripts (#7826)
Browse files Browse the repository at this point in the history
  • Loading branch information
zapashcanon authored and yyx990803 committed Mar 22, 2018
1 parent 903be9b commit 943e5c2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
18 changes: 10 additions & 8 deletions scripts/release-weex.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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*
Expand Down
24 changes: 13 additions & 11 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit 943e5c2

Please sign in to comment.