Skip to content

Commit 15d4d40

Browse files
author
Rishabh Karnad
committed
Prepared release script
1 parent c6e540a commit 15d4d40

File tree

1 file changed

+66
-38
lines changed

1 file changed

+66
-38
lines changed

build/release.sh

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,89 @@
11
set -e
22

3-
if [[ -z $1 ]]; then
4-
echo "Enter new version: "
5-
read VERSION
3+
# check if np is installed
4+
# if not, prompt the user to install it
5+
np_version=$(np --version)
6+
if [[ $? -eq 0 ]]; then
7+
echo "Using np version: " $np_version
68
else
7-
VERSION=$1
9+
echo "np is not installed"
10+
read -e -p "Install globally? (Executes: npm install -global np) [y/n]" REPLY
11+
if [[ $REPLY =~ ^(y|yes)$ ]]; then
12+
npm install -global np
13+
elif [[ $REPLY =~ ^(n|no)$ ]]; then
14+
echo "Exiting..."
15+
exit 1
16+
fi
17+
fi
18+
19+
# get the version number from the user
20+
read -e -p "Enter the new version" VERSION
21+
if [[ -z $VERSION ]]; then
22+
echo "No version entered. Exiting..."
23+
exit 0
824
fi
925

1026
read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r
1127
echo
1228
if [[ $REPLY =~ ^[Yy]$ ]]; then
1329
echo "Releasing $VERSION ..."
1430

15-
npm run lint
16-
npm run flow
17-
npm run test:cover
18-
npm run test:e2e
19-
npm run test:ssr
31+
# bump package versions
32+
# packages:
33+
# - vue-native-core
34+
# - vue-native-helper
35+
# - vue-native-scripts
36+
# - vue-native-template-compiler
2037

21-
if [[ -z $SKIP_SAUCE ]]; then
22-
export SAUCE_BUILD_ID=$VERSION:`date +"%s"`
23-
npm run test:sauce
24-
fi
38+
cd packages/vue-native-core
39+
npm version $VERSION
40+
cd -
2541

26-
# build
27-
VERSION=$VERSION npm run build
42+
cd packages/vue-native-helper
43+
npm version $VERSION
44+
cd -
2845

29-
# update packages
30-
cd packages/vue-template-compiler
46+
cd packages/vue-native-scripts
3147
npm version $VERSION
32-
if [[ -z $RELEASE_TAG ]]; then
33-
npm publish
34-
else
35-
npm publish --tag $RELEASE_TAG
36-
fi
3748
cd -
3849

39-
cd packages/vue-server-renderer
50+
cd packages/vue-native-template-compiler
4051
npm version $VERSION
41-
if [[ -z $RELEASE_TAG ]]; then
42-
npm publish
43-
else
44-
npm publish --tag $RELEASE_TAG
45-
fi
4652
cd -
4753

54+
# build
55+
# the build needs to be generated after the version bump
56+
# because the Vue version comes from packages/vue-native-core/package.json
57+
# refer to build/config.js
58+
VERSION=$VERSION npm run build
59+
4860
# commit
4961
git add -A
5062
git commit -m "[build] $VERSION"
51-
npm version $VERSION --message "[release] $VERSION"
52-
53-
# publish
54-
git push origin refs/tags/v$VERSION
55-
git push
56-
if [[ -z $RELEASE_TAG ]]; then
57-
npm publish
58-
else
59-
npm publish --tag $RELEASE_TAG
60-
fi
63+
64+
# use np to create release with VERSION and publish vue-native-core
65+
# you MUST be in the master branch to do this
66+
# if it fails, then the last commit is reset and the script exits
67+
# TODO: add tests and remove --yolo
68+
np --no-yarn --contents packages/vue-native-core --yolo $VERSION || { git reset --soft HEAD~1; exit 1; }
69+
70+
# publish packages
71+
# vue-native-core has already been published by np
72+
# packages:
73+
# - vue-native-helper
74+
# - vue-native-scripts
75+
# - vue-native-template-compiler
76+
77+
cd packages/vue-native-helper
78+
npm publish
79+
cd -
80+
81+
cd packages/vue-native-scripts
82+
npm publish
83+
cd -
84+
85+
cd packages/vue-native-template-compiler
86+
npm publish
87+
cd -
88+
6189
fi

0 commit comments

Comments
 (0)