Skip to content

Commit db97898

Browse files
authored
Merge pull request #201 from GeekyAnts/feat/release-script
Release script
2 parents 3cd3ab7 + 111e607 commit db97898

File tree

1 file changed

+55
-39
lines changed

1 file changed

+55
-39
lines changed

build/release.sh

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,77 @@
11
set -e
22

3-
if [[ -z $1 ]]; then
4-
echo "Enter new version: "
5-
read VERSION
6-
else
7-
VERSION=$1
3+
# check if np is installed
4+
np_version=$(np --version)
5+
echo "Using np:" $np_version
6+
7+
# get the version number from the user
8+
read -e -p "Enter the new Vue Native version: " VERSION
9+
if [[ -z $VERSION ]]; then
10+
echo "No version entered. Exiting..."
11+
exit 0
812
fi
913

1014
read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r
1115
echo
1216
if [[ $REPLY =~ ^[Yy]$ ]]; then
1317
echo "Releasing $VERSION ..."
1418

15-
npm run lint
16-
npm run flow
17-
npm run test:cover
18-
npm run test:e2e
19-
npm run test:ssr
19+
# bump package versions
20+
# packages:
21+
# - vue-native-core
22+
# - vue-native-helper
23+
# - vue-native-scripts
24+
# - vue-native-template-compiler
2025

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

26-
# build
27-
VERSION=$VERSION npm run build
30+
cd packages/vue-native-helper
31+
npm version $VERSION
32+
cd -
2833

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

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

42+
# build
43+
# the build needs to be generated after the version bump
44+
# because the Vue version comes from packages/vue-native-core/package.json
45+
# refer to build/config.js
46+
VERSION=$VERSION npm run build
47+
4848
# commit
4949
git add -A
5050
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
51+
52+
# use np to create release with VERSION and publish vue-native-core
53+
# you MUST be in the master branch to do this
54+
# if it fails, then the last commit is reset and the script exits
55+
# TODO: add tests and remove --yolo
56+
np --no-yarn --contents packages/vue-native-core --yolo $VERSION || { git reset --soft HEAD~1; exit 1; }
57+
58+
# publish packages
59+
# vue-native-core has already been published by np
60+
# packages:
61+
# - vue-native-helper
62+
# - vue-native-scripts
63+
# - vue-native-template-compiler
64+
65+
cd packages/vue-native-helper
66+
npm publish
67+
cd -
68+
69+
cd packages/vue-native-scripts
70+
npm publish
71+
cd -
72+
73+
cd packages/vue-native-template-compiler
74+
npm publish
75+
cd -
76+
6177
fi

0 commit comments

Comments
 (0)