@@ -12,19 +12,58 @@ match exactly, it falls back to the latest semver tag reachable from the
1212current HEAD.
1313
1414If the match is not exact or the current branch is not the default branch
15- or a protected branch, it creates a work-in-progress semver string like ` v0.1.2-myfeature.123 ` .
15+ or a protected branch (` CI_COMMIT_REF_PROTECTED ` or ` GITHUB_REF_PROTECTED ` are set),
16+ it creates a work-in-progress semver string like ` v0.1.2-myfeature.123 ` .
1617
1718Supports raw git repositories as well as GitLab and GitHub builders.
1819
19- ## Print current version of a git repository
20+ ### Installing
2021
2122``` sh
2223$ go install github.com/linkdata/gitsemver@latest
24+ ```
25+
26+ ### Command line parameters
27+
28+ ```
29+ Usage of gitsemver:
30+ -debug
31+ write debug info to stderr
32+ -git string
33+ path to Git executable (default "git")
34+ -gopackage
35+ write Go source with PkgName and PkgVersion
36+ -incpatch
37+ increment the patch level and create a new tag
38+ -name string
39+ override the Go PkgName, default is to use last portion of module in go.mod
40+ -nofetch
41+ don't fetch remote tags
42+ -nonewline
43+ don't print a newline after the output
44+ -out string
45+ write to file instead of stdout (relative paths are relative to repo)
46+ ```
47+
48+ ### Examples
49+
50+ #### Print current version of a git repository
51+
52+ ``` sh
2353$ gitsemver $HOME /myreleasedpackage
2454v1.2.3
2555```
2656
27- ## Generate a go package file with version information
57+ #### Increment the patch level and push a new lightweight tag to the origin
58+
59+ ``` sh
60+ $ gitsemver
61+ v1.2.3-main.456
62+ $ gitsemver -incpatch
63+ v1.2.4
64+ ```
65+
66+ #### Generate a go package file with version information
2867
2968``` go
3069// go:generate go run github.com/linkdata/gitsemver@latest -gopackage -out version.gen.go
0 commit comments