Skip to content

Commit b85b728

Browse files
Add pre-release and build options. (#27)
1 parent d838cb3 commit b85b728

File tree

6 files changed

+229
-35
lines changed

6 files changed

+229
-35
lines changed

.git-semver/plugins/keepachangelog.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ function run() {
2222
local version_new_actual="[${version_new}]"
2323
local version_previous=
2424

25+
# If the new version just has build information then skip the check
26+
if [ "${version_new%+*}" == "${version_current%+*}" ]
27+
then
28+
return ${status}
29+
fi
30+
2531
# If there is no existing version relax rules slightly
2632
if [ "" == "${version_current}" ]
2733
then

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
3-
This project adheres to [Semantic Versioning](http://semver.org/).
4-
This file uses change log convention from [Keep a CHANGELOG](http://keepachangelog.com).
3+
This project adheres to [Semantic Versioning].
4+
This file uses change log convention from [Keep a CHANGELOG].
55

66
## [Unreleased][unreleased]
7+
### Added
8+
- Added pre-release and build options. Note: the [keepachangelog.sh plugin] this will need to be updated to
9+
ignore versions which only differ in build metadata.
710

811
## [3.0.1] - 2018-07-13
912
### Fixed
@@ -89,8 +92,11 @@ This file uses change log convention from [Keep a CHANGELOG](http://keepachangel
8992

9093
[CHANGELOG.md]: CHANGELOG.md
9194
[CONTRIBUTING.md]: CONTRIBUTING.md
95+
[keepachangelog.sh plugin]: plugins/keepachangelog.sh
96+
[Keep a CHANGELOG]: http://keepachangelog.com
9297
[LICENCE.md]: LICENCE.md
9398
[README.md]: README.md
99+
[Semantic Versioning]: http://semver.org/
94100
[xdg_basedirs]: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
95101

96102
[unreleased]: https://github.com/markchalloner/git-semver/compare/3.0.1...HEAD

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ We accept contributions via Pull Requests on [Github](https://github.com/markcha
66

77
## Contributers
88

9+
### Users with merges
10+
911
- https://github.com/markchalloner/git-semver/graphs/contributors
1012

13+
### Others
14+
15+
- [@jaapio](https://github.com/jaapio) ([#26](https://github.com/markchalloner/git-semver/pull/26))
16+
1117
## Pull Requests
1218

1319
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.

README.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ The installer will not overwrite any existing [configuration](#configuration) or
5252

5353
## Usage
5454

55-
### Get latest version tag
55+
### Get highest version tag
5656

5757
``` bash
5858
git semver get
@@ -65,38 +65,61 @@ Will return empty if no version has been created.
6565
Versions are created as tags and are generated using:
6666

6767
``` bash
68-
git semver [major|minor|patch|next]
68+
git semver [major|minor|patch|next|pre-release|build] [-p <pre-release>] [-b <build>]
6969
```
7070

71-
#### Patch (Next)
71+
#### Major
7272

73-
Increment the patch component (0.1.0 -> 0.1.1)
73+
Increment the major component (0.1.0 -> 1.0.0), optionally adding a pre-release version and build metadata.
7474

7575
``` bash
76-
git semver patch|next
76+
git semver major [-p <pre-release>] [-b <build>]
7777
```
7878

79-
If no version has been created, the initial version will be: **0.1.0**
79+
If no version has been created, the initial version will be: **1.0.0\[-<pre-release>\]\[+<build>\]**
8080

8181
#### Minor
8282

83-
Increment the minor component (0.1.0 -> 0.2.0)
83+
Increment the minor component (0.1.0 -> 0.2.0), optionally adding a pre-release version and build metadata.
8484

8585
``` bash
86-
git semver minor
86+
git semver minor [-p <pre-release>] [-b <build>]
8787
```
8888

89-
If no version has been created, the initial version will be: **0.1.0**
89+
If no version has been created, the initial version will be: **0.1.0\[-<pre-release>\]\[+<build>\]**
9090

91-
#### Major
9291

93-
Increment the major component (0.1.0 -> 1.0.0)
92+
#### Patch (Next)
93+
94+
Increment the patch component (0.1.0 -> 0.1.1), optionally adding a pre-release version and build metadata.
95+
96+
``` bash
97+
git semver patch|next [-p <pre-release>] [-b <build>]
98+
```
99+
100+
If no version has been created, the initial version will be: **0.1.0\[-<pre-release>\]\[+<build>\]**
101+
102+
#### Pre-release
103+
104+
Create a new pre-release version based on the next patch version if a release version exists (0.1.0 ->
105+
0.1.1-<pre-release>) or the current patch version (0.1.0-alpha -> 0.1.0-<pre-release>) if it does not,
106+
optionally adding build metadata.
107+
108+
``` bash
109+
git semver pre-release -p <pre-release> [-b <build>]
110+
```
111+
112+
If no version has been created, the initial version will be: **0.1.0-<pre-release>\[+<build>\]**
113+
114+
#### Build
115+
116+
Create a new build based on the current patch version.
94117

95118
``` bash
96-
git semver major
119+
git semver build -b <build>
97120
```
98121

99-
If no version has been created, the initial version will be: **1.0.0**
122+
If no version has been created, the initial version will be: **0.1.0+<build>**
100123

101124
### Help
102125

0 commit comments

Comments
 (0)