Skip to content

Commit efcd922

Browse files
committed
chore(scripts): add guided publish script
1 parent 4b3f06b commit efcd922

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

publish.sh

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

0 commit comments

Comments
 (0)