This repository has been archived by the owner on Aug 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Nikita Chernyi
committed
Sep 26, 2017
0 parents
commit d9b2b87
Showing
2 changed files
with
53 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# bump.sh | ||
|
||
* Collects changes from commit summaries between branches | ||
* Generates file `CHANGELOG` with list of all changes | ||
* Commits that file with commit summary `Release v<NEW_VERSION>` | ||
* Creates new tag with release version | ||
* Pushes commit with new tag | ||
* Opens Gitlab Merge Request (url generated from origin url) with predefined title, description and branches in browser | ||
|
||
**PLEASE**, use http://semver.org/ | ||
|
||
## Integration with git | ||
|
||
```bash | ||
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 | ||
git config --global alias.bump "git-bump" | ||
``` | ||
|
||
## Usage | ||
|
||
```bash | ||
# Inside your repo | ||
git bump <BRANCH_FROM> <BRANCH_TO> | ||
``` | ||
|
||
`BRANCH_FROM` default: current branch | ||
|
||
`BRANCH_TO` default: master | ||
|
||
Just use: | ||
|
||
```bash | ||
git bump | ||
``` | ||
|
||
And enjoy magic :) |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
BRANCH_CURRENT=$(git rev-parse --abbrev-ref HEAD) | ||
BRANCH_1="${1:-$BRANCH_CURRENT}" | ||
BRANCH_2="${2:-master}" | ||
CHANGES=$(git log --oneline --no-merges --full-history $BRANCH_1...$BRANCH_2 | sed -u 's/^/\* /g') | ||
PREVIOUS_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
REPO_URL=$(git remote get-url origin | sed -u 's/git@//g; s/:/\//g; s/.git//g') | ||
printf "CHANGES:\n$CHANGES\n\n" | ||
echo -n "Enter new version (BRANCH: $BRANCH_CURRENT | Previous version: $PREVIOUS_VERSION): " | ||
read NEW_VERSION | ||
echo -e "# Release v$NEW_VERSION\n\n$CHANGES\n\n$(cat CHANGELOG)" > CHANGELOG | ||
git add CHANGELOG | ||
git commit -m "Release v$NEW_VERSION" | ||
git tag $NEW_VERSION | ||
git push --follow-tags | ||
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" |