Skip to content

Commit

Permalink
revise publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
arshaw committed Jan 20, 2019
1 parent 1aecd1a commit ec6ec08
Showing 1 changed file with 22 additions and 38 deletions.
60 changes: 22 additions & 38 deletions bin/publish-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,44 @@ cd "`dirname $0`/.."

./bin/require-clean-working-tree.sh

read -p "Enter the version you want to publish, with no 'v' (for example '1.0.1'): " version
if [[ ! "$version" ]]
package="$1"
version="$2"
scope="$3"

if [[ ! "$package" ]]
then
echo "Aborting."
echo "Invalid first argument package name."
exit 1
fi

read -p "Enter a version scope (latest/beta/alpha): " scope
if [[ "$scope" != "latest" ]] && [[ "$scope" != "beta" ]] && [[ "$scope" != "alpha" ]]
if [[ ! "$version" ]]
then
echo "Invalid scope '$scope'. Aborting."
echo "Invalid second argument version."
exit 1
fi

# push the current branch (assumes tracking is set up) and the tag
git push --recurse-submodules=on-demand
git push origin "v$version"

success=0

# save reference to current branch
current_branch=$(git symbolic-ref --quiet --short HEAD)

# temporarily checkout the tag's commit, publish to NPM
git checkout --quiet "v$version"
if npm publish --tag "$scope"
if [[ "$scope" != "latest" ]] && [[ "$scope" != "beta" ]] && [[ "$scope" != "alpha" ]]
then
success=1
echo "Invalid third argument scope '$scope'. Aborting."
exit 1
fi

# return to branch
git checkout --quiet "$current_branch"
# # push the current branch (assumes tracking is set up) and the tag
# git push --recurse-submodules=on-demand
# git push origin "v$version"

# restore generated dist files
git checkout --quiet "v$version" -- dist
git reset --quiet -- dist
if {
# check out dist files for tag
git checkout --quiet "v$version" -- dist &&

if [[ "$success" == "1" ]]
then
echo "Waiting for release to propagate to NPM..."
sleep 10

./bin/verify-npm.sh
cd "dist/$package" &&

echo
# npm publish --tag "$scope"
echo "FAKE NPM PUBLISH ($PWD)"
}
then
echo 'Success.'
echo 'You can now run:'
echo " ./bin/update-example-repo-deps.sh '$version' &&"
echo ' git push --recurse-submodules=on-demand &&'
echo ' ./bin/build-example-repos.sh --recent-release'
echo
else
echo
echo 'Failure.'
echo
exit 1
fi

0 comments on commit ec6ec08

Please sign in to comment.