Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9b5810
commit 8d32ea7
Showing
1 changed file
with
34 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,54 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
echo "> Building bundles" | ||
if ! [ -x "$(command -v dialog)" ]; then | ||
echo 'Error: dialog is not installed. Run: brew install dialog' >&2 | ||
exit 1 | ||
fi | ||
|
||
if ! [ -x "$(command -v semver)" ]; then | ||
echo 'Error: semver is not installed. Run: yarn global add semver' >&2 | ||
exit 1 | ||
fi | ||
|
||
if ! [ -x "$(command -v json)" ]; then | ||
echo 'Error: json is not installed. Run: yarn global add json' >&2 | ||
exit 1 | ||
fi | ||
|
||
current_version=$(cat package.json |json version) | ||
next_version=$(semver "$current_version" -i "$1") | ||
dialog --title "Do you release?" --yesno "Current version: $current_version\n\nNext version: $next_version" 0 0 | ||
|
||
dialog --title "Wait a moment" --infobox "Building the bundles with rollup..." 0 0 | ||
yarn clean | ||
yarn build | ||
|
||
sleep 5 | ||
dialog --title "Bump version" --yesno "Are you right to bump the version to $next_version?" 0 0 | ||
|
||
echo "> Bumping version to $1" | ||
dialog --title "Wait a moment" --infobox "Bumping version to $next_version..." 0 0 | ||
npm version $1 --no-git-tag-version | ||
VERSION=$(node -p -e "require('./package.json').version") | ||
git tag --annotate --message="Release $VERSION" $VERSION | ||
git tag --annotate --message="Release $next_version" $next_version | ||
|
||
echo "> Now is $VERSION" | ||
dialog --title "Publish version" --yesno "Are you right to publish version $next_version to registry?" 0 0 | ||
|
||
sleep 10 | ||
|
||
echo "> Publishing to NPM" | ||
dialog --title "Wait a moment" --infobox "Publishing version $next_version to NPM registry..." 0 0 | ||
cp package.json lib | ||
cd lib | ||
npm publish | ||
cd .. | ||
|
||
sleep 5 | ||
|
||
echo "> Releasing to Git" | ||
dialog --title "Wait a moment" --infobox "Committing the package.json..." 0 0 | ||
git add package.json | ||
git commit -m "Release $VERSION" | ||
git commit -m "Release $next_version" | ||
|
||
dialog --title "Push commit" --yesno "Are you right to push the tag to repository?" 0 0 | ||
|
||
dialog --title "Wait a moment" --infobox "Pushing the new tag to Git repository..." 0 0 | ||
git push --follow-tags | ||
|
||
echo "> Updating Changelog" | ||
dialog --title "Wait a moment" --infobox "Updating CHANGELOG.md..." 0 0 | ||
github_changelog_generator --no-unreleased | ||
git diff | ||
|
||
dialog --title "Congratulations!" --msgbox "Version $next_version released!\n\nNow, check the CHANGELOG.md to commit the changes" 0 0 |