-
Notifications
You must be signed in to change notification settings - Fork 57
/
release.sh
executable file
·59 lines (44 loc) · 2.03 KB
/
release.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
#!/bin/sh
set -e
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
if ! [ -x "$(command -v github_changelog_generator)" ]; then
echo 'Error: github_changelog_generator is not installed. Run: gem install github_changelog_generator faraday-retry' >&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
dialog --title "Bump version" --yesno "Are you right to bump the version to $next_version?" 0 0
dialog --title "Wait a moment" --infobox "Bumping version to $next_version..." 0 0
npm version $1 --no-git-tag-version
git tag --annotate --message="Release $next_version" $next_version
dialog --title "Publish version" --yesno "Are you right to publish version $next_version to registry?" 0 0
dialog --title "Wait a moment" --infobox "Publishing version $next_version to NPM registry..." 0 0
cp package.json lib
cd lib
npm publish
cd ..
dialog --title "Wait a moment" --infobox "Committing the package.json..." 0 0
git add package.json
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
dialog --title "Wait a moment" --infobox "Updating CHANGELOG.md..." 0 0
github_changelog_generator --user andersonba --project yve-bot --no-unreleased
dialog --title "Congratulations!" --msgbox "Version $next_version released!\n\nNow, check the CHANGELOG.md to commit the changes" 0 0
git diff