From 1e20a8dc5016f9e4d1975be3c89153ca5071d508 Mon Sep 17 00:00:00 2001 From: Ben Lesh Date: Wed, 6 Dec 2017 10:02:13 -0800 Subject: [PATCH] chore(scripts): add guided publish script --- publish.sh | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 publish.sh diff --git a/publish.sh b/publish.sh new file mode 100644 index 0000000000..9aa32fa597 --- /dev/null +++ b/publish.sh @@ -0,0 +1,65 @@ +#!/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 + + 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