File tree 14 files changed +129
-14
lines changed
src/main/scala/net/cardnell/mkver 14 files changed +129
-14
lines changed Original file line number Diff line number Diff line change 1
1
import Dependencies ._
2
2
3
3
ThisBuild / scalaVersion := " 2.12.11"
4
- ThisBuild / version := " 0.6.0 "
4
+ ThisBuild / version := " 0.5.1 "
5
5
ThisBuild / organization := " net.cardnell"
6
6
7
7
lazy val root = (project in file(" ." ))
Original file line number Diff line number Diff line change @@ -8,23 +8,43 @@ version=`git mkver next`
8
8
sbt assembly
9
9
10
10
# Mac
11
- if [[ " $( uname) " == " Darwin " ]]
11
+ if [[ " $( uname) " == " Darwin" ]]
12
12
then
13
13
pushd target
14
14
native-image -H:IncludeResources=' .*conf$' --no-fallback -jar scala-2.12/git-mkver-assembly-$version .jar
15
15
mv git-mkver-assembly-$version git-mkver-darwin-amd64-$version
16
+ cp git-mkver-darwin-amd64-$version git-mkver
17
+ chmod +x git-mkver
18
+ tar -cvzf git-mkver-darwin-amd64-$version .tar.gz git-mkver
19
+ rm git-mkver
16
20
popd
17
21
18
22
# Linux
19
23
docker run -v $( pwd) :/workspace -it git-mkver \
20
24
/bin/bash -c " cd /workspace/target; native-image -H:IncludeResources='.*conf$' --no-fallback -jar scala-2.12/git-mkver-assembly-$version .jar; mv git-mkver-assembly-$version git-mkver-linux-amd64-$version "
25
+
26
+ pushd target
27
+ cp git-mkver-linux-amd64-$version git-mkver
28
+ chmod +x git-mkver
29
+ tar -cvzf git-mkver-linux-amd64-$version .tar.gz git-mkver
30
+ rm git-mkver
31
+ popd
32
+
33
+ DARWIN_SHA256=$( openssl dgst -sha256 target/git-mkver-darwin-amd64-$version .tar.gz | cut -f2 -d' ' )
34
+ LINUX_SHA256=$( openssl dgst -sha256 target/git-mkver-linux-amd64-$version .tar.gz | cut -f2 -d' ' )
35
+
36
+ sed -i ' ' -e " s/MKVER_SHA256 = \" .*\" .freeze/MKVER_SHA256 = \" $DARWIN_SHA256 \" .freeze/g" etc/Formula/git-mkver.rb
21
37
fi
22
38
23
39
# Linux
24
- if [[ " $( uname) " == " Linux " ]]
40
+ if [[ " $( uname) " == " Linux" ]]
25
41
then
26
42
pushd target
27
43
native-image -H:IncludeResources=' .*conf$' --no-fallback -jar scala-2.12/git-mkver-assembly-$version .jar
28
44
mv git-mkver-assembly-$version git-mkver-linux-amd64-$version
45
+ cp git-mkver-linux-amd64-$version git-mkver
46
+ chmod +x git-mkver
47
+ tar -cvzf git-mkver-linux-amd64-$version .tar.gz git-mkver
48
+ rm git-mkver
29
49
popd
30
50
fi
Original file line number Diff line number Diff line change 3
3
< h2 > < a href ="/ "> Home</ a > </ h2 >
4
4
< h2 > < a href ="installation "> Installation</ a > </ h2 >
5
5
< h2 > < a href ="usage "> Usage</ a > </ h2 >
6
- < h2 > < a href ="common_patterns "> Common Patterns</ a > </ h2 >
7
6
< h2 > < a href ="config_reference "> Config Reference</ a > </ h2 >
7
+ < h2 > < a href ="config_examples "> Config Examples</ a > </ h2 >
8
+ < h2 > < a href ="branching_models "> Branching Models</ a > </ h2 >
8
9
< h2 > < a href ="formats "> Version Formatting</ a > </ h2 >
9
10
</ nav >
10
11
</ div >
Original file line number Diff line number Diff line change 1
- # Usage Patterns
1
+ # Branching Models
2
2
3
3
Below are some popular git branching development models and how to configure them with git-mkver:
4
4
- master (aka trunk) based development
@@ -29,6 +29,8 @@ The build script run by the build server would look something like:
29
29
30
30
``` bash
31
31
nextVer=$( git mkver next)
32
+ # patch the version number into files as needed
33
+ git mkver patch
32
34
# build software ...
33
35
# If successful:
34
36
git mkver tag
Original file line number Diff line number Diff line change
1
+ # Config Examples
2
+
3
+ Below are some examples of common configuration.
4
+
5
+ ## Patching README.md
6
+
7
+ I would like to update my README.md and others docs with the latest version number.
8
+
9
+ ``` hocon
10
+ defaults {
11
+ patches: [
12
+ Docs
13
+ ]
14
+ }
15
+ patches: [
16
+ {
17
+ name: Docs
18
+ filePatterns: [
19
+ "README.md"
20
+ "docs/installation.md"
21
+ ]
22
+ find: "\\d+\\.\\d+\\.\\d+"
23
+ replace: "{Next}"
24
+ }
25
+ ]
26
+ ```
27
+
28
+ # I would like a different version format for docker tags
29
+
30
+ Docker does not support ` + ` symbols from semantics versions. Create a
31
+ format for Docker tags. Additionally ` master ` branch should be a Version
32
+ only while other branches should include build metadata.
Original file line number Diff line number Diff line change @@ -7,10 +7,6 @@ For example git is happy with the SemVer standard for tagging but docker does no
7
7
8
8
All replacements in format strings start with ` { ` and end with ` } ` . They are recursively replaced so that one may refer to another.
9
9
10
- ## Examples
11
-
12
-
13
-
14
10
## SemVer Formats
15
11
16
12
The following built in formats conform to the SemVer spec. They cannot be overriden.
@@ -22,7 +18,6 @@ The following built in formats conform to the SemVer spec. They cannot be overri
22
18
| ` VersionBuildMetaData ` | ` {Version}+{BuildMetaData} ` |
23
19
| ` VersionPreReleaseBuildMetaData ` | ` {Version}-{PreRelease}+{BuildMetaData} ` |
24
20
25
-
26
21
## Built-in Formats
27
22
28
23
| Format Token | Substitution |
@@ -49,4 +44,4 @@ The following built in formats conform to the SemVer spec. They cannot be overri
49
44
50
45
All environment variables are available under a set of formats prefixed with ` env. ` .
51
46
For example ` {env.BUILD_NUMBER} ` would get the ` BUILD_NUMBER ` environment variable.
52
- This is most useful for getting information from build systems.
47
+ This is most useful for getting information from build systems.
Original file line number Diff line number Diff line change 1
1
# Installation
2
2
3
+ ## Linux
4
+
5
+ ``` bash
6
+ curl -L https://github.com/idc101/git-mkver/releases/download/v0.5.1/git-mkver-darwin-amd64-0.5.1.tar.gz | tar xvz
7
+ sudo mv git-mkver /usr/local/bin
8
+ ```
9
+
10
+ ## Mac OS
11
+
12
+ Install with [ Homebrew] ( https://brew.sh ) :
13
+
14
+ ``` bash
15
+ brew install https://raw.githubusercontent.com/idc101/git-mkver/master/etc/Formula/git-mkver.rb
16
+ ```
17
+
18
+ ## Windows
19
+
20
+ Install with [ scoop] ( https://scoop.sh ) :
21
+
22
+ ``` cmd
23
+ scoop install https://raw.githubusercontent.com/idc101/git-mkver/master/etc/Formula/git-mkver.rb
24
+ ```
25
+
26
+ ## Manual
27
+
3
28
1 . Download the binary for your os from the [ releases] ( https://github.com/idc101/git-mkver/releases ) page.
4
29
2 . Move it to a directory on your path
5
30
Original file line number Diff line number Diff line change @@ -47,8 +47,7 @@ This will apply an annotated tag from the `next` command to the current commit.
47
47
48
48
If you would like to patch version numbers in files prior to building and tagging then
49
49
you can use the ` patch ` command. The files to be patched and the replacements are
50
- defined in the ` mkver.yaml ` config file. A large number of standard patches come
51
- pre-defined.
50
+ defined in the ` mkver.conf ` [ config] ( config ) file.
52
51
53
52
``` bash
54
53
$ git mkver patch
Original file line number Diff line number Diff line change
1
+ class GitMkver < Formula
2
+ MKVER_VERSION = "0.5.1" . freeze
3
+ MKVER_SHA256 = "60b12160b0754e5e9d0b631ae0b8537d6aca33a77e6aff240b049c0dac17dbaf" . freeze
4
+
5
+ desc "Installs git-mkver from pre-built binaries"
6
+ homepage "https://idc101.github.io/git-mkver/"
7
+ url "https://github.com/idc101/git-mkver/releases/download/v#{ MKVER_VERSION } /git-mkver-darwin-amd64-#{ MKVER_VERSION } .tar.gz"
8
+ version MKVER_VERSION
9
+ sha256 MKVER_SHA256
10
+
11
+ def install
12
+ bin . install 'git-mkver'
13
+ end
14
+ end
Original file line number Diff line number Diff line change
1
+ {
2
+ "version" : " 0.5.1" ,
3
+ "description" : " Automatic Semantic Versioning for git based software development" ,
4
+ "url" : " https://github.com/idc101/git-mkver/releases/download/v0.5.1/git-mkver-windows-amd64-0.5.1.zip" ,
5
+ "extract_dir" : " git-mkver" ,
6
+ "bin" : " git-mkver.exe"
7
+ }
Original file line number Diff line number Diff line change
1
+ # /bin/bash
2
+ MKVER_VERSION=0.5.1
3
+ curl -L https://github.com/idc101/git-mkver/releases/download/v${MKVER_VERSION} /git-mkver-darwin-amd64-${MKVER_VERSION} .tar.gz -o git-mkver.tar.gz
4
+ tar xvzf git-mkver.tar.gz
5
+ sudo mv git-mkver /usr/local/bin
6
+ rm git-mkver.tar.gz
Original file line number Diff line number Diff line change 2
2
defaults {
3
3
patches: [
4
4
Sbt
5
+ Installers
5
6
]
6
7
}
7
8
patches: [
@@ -11,4 +12,15 @@ patches: [
11
12
find: "version\\s+:=\\s+\".*\""
12
13
replace: "version := \"{Next}\""
13
14
}
15
+ {
16
+ name: Installers
17
+ filePatterns: [
18
+ "docs/installation.md"
19
+ "etc/Formula/git-mkver.rb"
20
+ "etc/scoop/git-mkver.json"
21
+ "etc/shell/install.sh"
22
+ ]
23
+ find: "\\d+\\.\\d+\\.\\d+"
24
+ replace: "{Next}"
25
+ }
14
26
]
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ object CommandLineArgs {
41
41
val commandLineOpts : Opts [CommandLineOpts ] = (configFile, commands).mapN(CommandLineOpts .apply)
42
42
43
43
val mkverCommand : Command [CommandLineOpts ] = Command (
44
- name = " git-mkver" ,
44
+ name = s " git-mkver - v ${ GitMkverVersion } " ,
45
45
header = " Uses git tags, branch names and commit messages to determine the next version of the software to release"
46
46
) {
47
47
commandLineOpts
Original file line number Diff line number Diff line change @@ -4,4 +4,6 @@ import zio.Has
4
4
5
5
package object mkver {
6
6
type Git = Has [Git .Service ]
7
+
8
+ val GitMkverVersion = " 0.5.1"
7
9
}
You can’t perform that action at this time.
0 commit comments