Skip to content

Commit 5408928

Browse files
committed
Update README.md
1 parent 77def9d commit 5408928

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

README.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,48 @@
1-
# GmodNetVersionTool
2-
GmodNET Version Tool
1+
# GmodNET Version Tool
2+
3+
A git-based [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) compatible version number generator.
4+
5+
## Description
6+
7+
GmodNET Version Tool generates a version number of the form `[FullVersion]+codename.[codename from version JSON file].head.[git head name].commit.[hexadecimal representation of git commit hash].[any additional metadata provided in a "Version" key-value pair of the version JSON file]` based on the version file and git repository state.
8+
9+
Version file is a JSON file containing key `Version` with corresponding value being a [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html) compatible version base (initial part of the resulting version) and optional key `Codename`.
10+
11+
For example, given that repository HEAD points to `NewFeature` branch and version file
12+
```json
13+
{
14+
"Version": "0.6.0-beta.1"
15+
}
16+
```
17+
the resulting version will be equal to
18+
19+
`0.6.0-beta.1.943586.NewFeature+head.NewFeature.commit.a3455d90049f17b6ac3bbc54177cfb51b0803851`
20+
21+
or given that git HEAD points to `master` branch and version file
22+
```json
23+
{
24+
"Version": "1.0.0+bugfix14",
25+
"Codename": "Ural"
26+
}
27+
```
28+
the resulting version will be equal to
29+
30+
`1.0.0+codename.Ural.head.master.commit.e796d2d62d39256f9c3e55b3648cd2bfb289e7bc.bugfix14`.
31+
32+
You can read about version number generation in more detail in the Version Tool [specification](docs/specification.md).
33+
34+
## Usage
35+
36+
The most straightforward way to use GmodNET Version Tool with .NET projects is to consume GmodNET.VersionTool.MSBuild NuGet package. Just add package reference and specify version file to use by adding similar `ItemGroup` to your MSBuild project:
37+
```xml
38+
<ItemGroup>
39+
<PackageReference Include="GmodNET.VersionTool.MSBuild" Version="2.0.0" PrivateAssets="All"/>
40+
<VersionFile Include="../version.json" />
41+
</ItemGroup>
42+
```
43+
44+
GmodNET.VersionTool.MSBuild will automatically generate version number and set `Version` and `PackageVersion` properties for each build.
45+
46+
There is a cross-platform [.NET command line tool](https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools) implementation of GmodNET Version Tool: GmodNET.VersionTool. It can be used from shell or any other build systems like make, cmake, etc.
47+
48+
GmodNET.VersioTool.Core is a NuGet package containing .NET Standard 2.0 class library which can be used to generate version numbers from other .NET applications.

0 commit comments

Comments
 (0)