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