11set -e
22
3- # check if np is installed
4- np_version=$( np --version)
5- echo " Using np:" $np_version
3+ CURRENT_BRANCH=$( git branch --show-current)
4+ if [ $CURRENT_BRANCH != " master" ]; then
5+ echo " This script can only be run in the master branch. Exiting..."
6+ exit 1
7+ fi
68
79# get the version number from the user
810read -e -p " Enter the new Vue Native version: " VERSION
@@ -49,19 +51,18 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
4951 git add -A
5052 git commit -m " [build] $VERSION "
5153
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-
5854 # publish packages
5955 # vue-native-core has already been published by np
6056 # packages:
57+ # - vue-native-core
6158 # - vue-native-helper
6259 # - vue-native-scripts
6360 # - vue-native-template-compiler
6461
62+ cd packages/vue-native-core
63+ npm publish
64+ cd -
65+
6566 cd packages/vue-native-helper
6667 npm publish
6768 cd -
@@ -74,4 +75,12 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
7475 npm publish
7576 cd -
7677
78+ # Update version in main package.json and commit
79+ npm version $VERSION
80+
81+ # Push the tags and version update
82+ git push origin v$VERSION
83+ git push origin master
84+
85+ echo " \nPublished v$VERSION !"
7786fi
0 commit comments