|
1 | 1 | set -e |
2 | 2 |
|
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 |
8 | 12 | fi |
9 | 13 |
|
10 | 14 | read -p "Releasing $VERSION - are you sure? (y/n) " -n 1 -r |
11 | 15 | echo |
12 | 16 | if [[ $REPLY =~ ^[Yy]$ ]]; then |
13 | 17 | echo "Releasing $VERSION ..." |
14 | 18 |
|
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 |
20 | 25 |
|
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 - |
25 | 29 |
|
26 | | - # build |
27 | | - VERSION=$VERSION npm run build |
| 30 | + cd packages/vue-native-helper |
| 31 | + npm version $VERSION |
| 32 | + cd - |
28 | 33 |
|
29 | | - # update packages |
30 | | - cd packages/vue-template-compiler |
| 34 | + cd packages/vue-native-scripts |
31 | 35 | npm version $VERSION |
32 | | - if [[ -z $RELEASE_TAG ]]; then |
33 | | - npm publish |
34 | | - else |
35 | | - npm publish --tag $RELEASE_TAG |
36 | | - fi |
37 | 36 | cd - |
38 | 37 |
|
39 | | - cd packages/vue-server-renderer |
| 38 | + cd packages/vue-native-template-compiler |
40 | 39 | npm version $VERSION |
41 | | - if [[ -z $RELEASE_TAG ]]; then |
42 | | - npm publish |
43 | | - else |
44 | | - npm publish --tag $RELEASE_TAG |
45 | | - fi |
46 | 40 | cd - |
47 | 41 |
|
| 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 | + |
48 | 48 | # commit |
49 | 49 | git add -A |
50 | 50 | 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 | + |
61 | 77 | fi |
0 commit comments