Skip to content

Commit 943e5c2

Browse files
zapashcanonyyx990803
authored andcommitted
workflow: clean shell scripts (#7826)
1 parent 903be9b commit 943e5c2

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

Diff for: scripts/release-weex.sh

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
#!/bin/bash
12
set -e
2-
CUR_VERSION=`node build/get-weex-version.js -c`
3-
NEXT_VERSION=`node build/get-weex-version.js`
3+
CUR_VERSION=$(node build/get-weex-version.js -c)
4+
NEXT_VERSION=$(node build/get-weex-version.js)
45

56
echo "Current: $CUR_VERSION"
67
read -p "Enter new version ($NEXT_VERSION): " -n 1 -r
@@ -20,15 +21,16 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
2021
WEEX_VERSION=$NEXT_VERSION npm run build:weex
2122

2223
# update package
23-
cd packages/weex-vue-framework
24-
npm version $NEXT_VERSION
24+
# using subshells to avoid having to cd back
25+
( cd packages/weex-vue-framework
26+
npm version "$NEXT_VERSION"
2527
npm publish
26-
cd -
28+
)
2729

28-
cd packages/weex-template-compiler
29-
npm version $NEXT_VERSION
30+
( cd packages/weex-template-compiler
31+
npm version "$NEXT_VERSION"
3032
npm publish
31-
cd -
33+
)
3234

3335
# commit
3436
git add packages/weex*

Diff for: scripts/release.sh

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
#!/bin/bash
12
set -e
23

34
if [[ -z $1 ]]; then
45
echo "Enter new version: "
5-
read VERSION
6+
read -r VERSION
67
else
78
VERSION=$1
89
fi
@@ -32,23 +33,24 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
3233
VERSION=$VERSION npm run build
3334

3435
# update packages
35-
cd packages/vue-template-compiler
36-
npm version $VERSION
36+
# using subshells to avoid having to cd back
37+
( ( cd packages/vue-template-compiler
38+
npm version "$VERSION"
3739
if [[ -z $RELEASE_TAG ]]; then
3840
npm publish
3941
else
40-
npm publish --tag $RELEASE_TAG
42+
npm publish --tag "$RELEASE_TAG"
4143
fi
42-
cd -
44+
)
4345

4446
cd packages/vue-server-renderer
45-
npm version $VERSION
47+
npm version "$VERSION"
4648
if [[ -z $RELEASE_TAG ]]; then
4749
npm publish
4850
else
49-
npm publish --tag $RELEASE_TAG
51+
npm publish --tag "$RELEASE_TAG"
5052
fi
51-
cd -
53+
)
5254

5355
# commit
5456
git add -A
@@ -63,14 +65,14 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
6365
# generate release note
6466
npm run release:note
6567
# tag version
66-
npm version $VERSION --message "build: release $VERSION"
68+
npm version "$VERSION" --message "build: release $VERSION"
6769

6870
# publish
69-
git push origin refs/tags/v$VERSION
71+
git push origin refs/tags/v"$VERSION"
7072
git push
7173
if [[ -z $RELEASE_TAG ]]; then
7274
npm publish
7375
else
74-
npm publish --tag $RELEASE_TAG
76+
npm publish --tag "$RELEASE_TAG"
7577
fi
7678
fi

0 commit comments

Comments
 (0)