You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Background Summary**
This PR adds support for incrementing prerelease versions by default, if it ends in a number. Currently, if a prerelease version is incremented, the prerelease qualifier is simply dropped. E.g. `1.0.0-RC1` will be incremented to `1.0.0`. After this merge, `1.0.0-RC1` will be incremented to `1.0.0-RC2`, but prerelease versions without a version number will behave as before: `1.0.0-alpha` will be incremented to `1.0.0`.
**New/Updated Versioning Strategies**
`Next` (**updated - breaking change**): Will now increment prerelease versions, unlike in the past. So `1.0-RC1` will become `1.0-RC2`. Previously `1.0-RC1` would become `1.1`.
`NextStable` (**new**): The same as `Next` except that it excludes any prerelease versions. So `1.0.0-RC1` becomes `1.0.0`
Copy file name to clipboardExpand all lines: README.md
+18-20Lines changed: 18 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,21 +109,31 @@ A cross release behaves analogous to using the `+` command:
109
109
110
110
In the section *Customizing the release process* we take a look at how to define a `ReleaseStep` to participate in a cross build.
111
111
112
-
### Convenient versioning
112
+
### Versioning Strategies
113
113
114
-
As of version 0.8, *sbt-release* comes with some strategies for computing the next snapshot version via the `releaseVersionBump` setting. These strategies are defined in `sbtrelease.Version.Bump`. By default, the `Next` strategy is used:
114
+
As of version 0.8, *sbt-release* comes with several strategies for computing the next snapshot version via the `releaseVersionBump` setting. These strategies are defined in `sbtrelease.Version.Bump`. By default, the `Next` strategy is used:
115
115
116
116
*`Major`: always bumps the *major* part of the version
117
117
*`Minor`: always bumps the *minor* part of the version
118
118
*`Bugfix`: always bumps the *bugfix* part of the version
119
119
*`Nano`: always bumps the *nano* part of the version
120
-
*`Next`: bumps the last version part (e.g. `0.17` -> `0.18`, `0.11.7` -> `0.11.8`, `3.22.3.4.91` -> `3.22.3.4.92`)
120
+
*`Next` (**default**): bumps the last version part, including the qualifier (e.g. `0.17` -> `0.18`, `0.11.7` -> `0.11.8`, `3.22.3.4.91` -> `3.22.3.4.92`, `1.0.0-RC1` -> `1.0.0-RC2`)
121
+
*`NextStable`: bumps exactly like `Next` except that any prerelease qualifier is excluded (e.g. `1.0.0-RC1` -> `1.0.0`)
121
122
122
-
Example:
123
+
Users can set their preferred versioning strategy in `build.sbt` as follows:
The default settings make use of the helper class [`Version`](https://github.com/sbt/sbt-release/blob/master/src/main/scala/Version.scala) that ships with *sbt-release*.
131
+
132
+
`releaseVersion`: The current version in version.sbt, without the "-SNAPSHOT" ending. So, if `version.sbt` contains `1.0.0-SNAPSHOT`, the release version will be set to `1.0.0`.
`releaseNextVersion`: The "bumped" version according to the versioning strategy (explained above), including the `-SNAPSHOT` ending. So, if `releaseVersion` is `1.0.0`, `releaseNextVersion` will be `1.0.1-SNAPSHOT`.
125
135
126
-
### Custom versioning
136
+
### Custom Versioning
127
137
128
138
*sbt-release* comes with two settings for deriving the release version and the next development version from a given version.
129
139
@@ -132,20 +142,8 @@ These derived versions are used for the suggestions/defaults in the prompt and f
132
142
Let's take a look at the types:
133
143
134
144
```scala
135
-
valreleaseVersion:SettingKey[String=>String]
136
-
valreleaseNextVersion:SettingKey[String=>String]
137
-
```
138
-
139
-
The default settings make use of the helper class [`Version`](https://github.com/sbt/sbt-release/blob/master/src/main/scala/Version.scala) that ships with *sbt-release*.
140
-
141
-
```scala
142
-
// strip the qualifier off the input version, eg. 1.2.1-SNAPSHOT -> 1.2.1
143
-
releaseVersion := { ver =>Version(ver).map(_.withoutQualifier.string).getOrElse(versionFormatError(ver)) }
144
-
145
-
// bump the version and append '-SNAPSHOT', eg. 1.2.1 -> 1.3.0-SNAPSHOT
146
-
releaseNextVersion := {
147
-
ver =>Version(ver).map(_.bump(releaseVersionBump.value).asSnapshot.string).getOrElse(versionFormatError(ver))
148
-
},
145
+
valreleaseVersion:TaskKey[String=>String]
146
+
valreleaseNextVersion:TaskKey[String=>String]
149
147
```
150
148
151
149
If you want to customize the versioning, keep the following in mind:
0 commit comments