Skip to content
This repository was archived by the owner on Aug 25, 2022. It is now read-only.

Commit d9b2b87

Browse files
author
Nikita Chernyi
committed
Init
0 parents  commit d9b2b87

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# bump.sh
2+
3+
* Collects changes from commit summaries between branches
4+
* Generates file `CHANGELOG` with list of all changes
5+
* Commits that file with commit summary `Release v<NEW_VERSION>`
6+
* Creates new tag with release version
7+
* Pushes commit with new tag
8+
* Opens Gitlab Merge Request (url generated from origin url) with predefined title, description and branches in browser
9+
10+
**PLEASE**, use http://semver.org/
11+
12+
## Integration with git
13+
14+
```bash
15+
sudo curl -o /usr/local/bin/git-bump -s https://raw.githubusercontent.com/rakshazi/bump.sh/master/bin && sudo chmod +x /usr/local/bin/git-bump
16+
git config --global alias.bump "git-bump"
17+
```
18+
19+
## Usage
20+
21+
```bash
22+
# Inside your repo
23+
git bump <BRANCH_FROM> <BRANCH_TO>
24+
```
25+
26+
`BRANCH_FROM` default: current branch
27+
28+
`BRANCH_TO` default: master
29+
30+
Just use:
31+
32+
```bash
33+
git bump
34+
```
35+
36+
And enjoy magic :)

bin

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
BRANCH_CURRENT=$(git rev-parse --abbrev-ref HEAD)
4+
BRANCH_1="${1:-$BRANCH_CURRENT}"
5+
BRANCH_2="${2:-master}"
6+
CHANGES=$(git log --oneline --no-merges --full-history $BRANCH_1...$BRANCH_2 | sed -u 's/^/\* /g')
7+
PREVIOUS_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
8+
REPO_URL=$(git remote get-url origin | sed -u 's/git@//g; s/:/\//g; s/.git//g')
9+
printf "CHANGES:\n$CHANGES\n\n"
10+
echo -n "Enter new version (BRANCH: $BRANCH_CURRENT | Previous version: $PREVIOUS_VERSION): "
11+
read NEW_VERSION
12+
echo -e "# Release v$NEW_VERSION\n\n$CHANGES\n\n$(cat CHANGELOG)" > CHANGELOG
13+
git add CHANGELOG
14+
git commit -m "Release v$NEW_VERSION"
15+
git tag $NEW_VERSION
16+
git push --follow-tags
17+
xdg-open "$REPO_URL/merge_requests/new?utf8=✓&merge_request[source_branch]=$BRANCH_1&merge_request[target_branch]=$BRANCH_2&merge_request[title]=$NEW_VERSION&merge_request[description]=$CHANGES"

0 commit comments

Comments
 (0)