1 | #!/bin/bash
|
2 |
|
3 | echo "Publish master or stable?"
|
4 | select branch in "master" "stable"; do
|
5 | read -p "You selected $branch. [Enter] to continue"
|
6 | git checkout $branch
|
7 |
|
8 | git pull upstream $branch
|
9 |
|
10 | read -p "Just pulled $branch from upstream. If everything is okay, hit [Enter]"
|
11 |
|
12 | echo "Clear node_modules?"
|
13 | select yn in "Yes" "No"; do
|
14 | case $yn in
|
15 | Yes) rm -rf node_modules/; npm i; break;;
|
16 | No) echo "Skipped clearing node_modules"; break;;
|
17 | esac
|
18 | done
|
19 |
|
20 | if [ $branch = "master" ]; then
|
21 | echo "You cannot publish master from this script at this time. To continue, publish manually from this point."
|
22 | exit 1
|
23 | fi
|
24 |
|
25 | echo "What type of publish?"
|
26 | select version_type in "patch" "minor" "major"; do
|
27 | read -p "Creating commit and tag for a $version_type release. Press [Enter].";
|
28 |
|
29 |
|
30 | version_with_v=`npm version $version_type`
|
31 |
|
32 |
|
33 | version=`echo $version_with_v | cut -b 2-`
|
34 |
|
35 |
|
36 |
|
37 | git tag -d $version_with_v
|
38 |
|
39 | echo "Deleted tag because it's wrong, no worries, we'll tag again in a sec"
|
40 |
|
41 | echo "Generating CHANGELOG.md"
|
42 | npm run generate_changelog
|
43 |
|
44 |
|
45 | git diff
|
46 | read -p "Examine and correct CHANGELOG.md. [Enter] to continue"
|
47 |
|
48 | git tag $version
|
49 |
|
50 |
|
51 | read -p "git tag updated to $version; [Enter] to continue";
|
52 | break
|
53 | done
|
54 |
|
55 |
|
56 | read -p "Ready to publish @reactivex/rxjs@$version. [Enter] to continue"
|
57 | npm publish
|
58 |
|
59 | read -p "Ready to publish rxjs@$version. [Enter] to continue"
|
60 | cd dist/package/
|
61 | npm publish
|
62 | cd ../../
|
63 |
|
64 | read -p "Ready to push $branch to upstream. [Enter] to continue"
|
65 | git push upstream $branch
|
66 | git push upstream --tags
|
67 |
|
68 | break
|
69 | done
|