Skip to content

Commit 5e3dd4e

Browse files
authored
Improved bin/release (#95)
1 parent 2263182 commit 5e3dd4e

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

bin/release

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,32 @@
33
VERSION=$1
44

55
if [ -z "$VERSION" ]; then
6-
echo "Error: The version number is required."
7-
echo "Usage: $0 <version-number>"
6+
echo "Error: Version number or bump type is required."
7+
echo "Usage: $0 <major|minor|patch|version-number>"
8+
89
exit 1
910
fi
1011

12+
if [[ "$VERSION" =~ ^(major|minor|patch)$ ]]; then
13+
CURRENT=$(grep -o '"[^"]*"' ./lib/rails_icons/version.rb | tr -d '"')
14+
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
15+
16+
case $VERSION in
17+
major) VERSION="$((MAJOR + 1)).0.0" ;;
18+
minor) VERSION="$MAJOR.$((MINOR + 1)).0" ;;
19+
patch) VERSION="$MAJOR.$MINOR.$((PATCH + 1))" ;;
20+
esac
21+
fi
22+
1123
printf "module RailsIcons\n VERSION = \"$VERSION\"\nend\n" > ./lib/rails_icons/version.rb
24+
1225
bundle
26+
1327
git add Gemfile.lock lib/rails_icons/version.rb
1428
git commit -m "Bump version for $VERSION"
1529
git push
1630
git tag v$VERSION
1731
git push --tags
18-
gem build rails_icons.gemspec
19-
gem push "rails_icons-$VERSION.gem"
32+
33+
bundle exec rake build
34+
gem push "pkg/rails_icons-$VERSION.gem"

0 commit comments

Comments
 (0)