Skip to content

Commit 2e79c27

Browse files
committed
feat: versioning this repo with git-mkver :-)
1 parent 699068c commit 2e79c27

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

docs/config_reference.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,17 @@ branches: [
7070
# patches control how files are updated
7171
patches: [
7272
{
73+
# name of the patch, referenced from the branch configs
7374
name: HelmChart
74-
filePatterns: ["**/Chart.yaml"]
75+
# files to match, can include glob wildcards
76+
filePatterns: [
77+
"**Chart.yaml" # Chart.yaml in current working directory or any subdirectory of the current working directory
78+
"**/Chart.yaml" # Chart.yaml in any subdirectory of the current working directory
79+
"Chart.yaml" # Chart.yaml the current working directory only
80+
]
81+
# search string, using java regular expression syntax (https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html)
7582
find: "appVersion: .*"
83+
# replacement string using substitutions from formats
7684
replace: "appVersion: \"{Version}\""
7785
}
7886
{

mkver.conf

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# We won't set most of the defaults, the application defaults are fine
2+
defaults {
3+
patches: [
4+
Sbt
5+
]
6+
}
7+
branches: [
8+
{
9+
name: "master"
10+
tag: true
11+
tagFormat: Version
12+
}
13+
]
14+
patches: [
15+
{
16+
name: Sbt
17+
filePatterns: ["build.sbt"]
18+
find: "version\\s+:=\\s+\".*\""
19+
replace: "version := \"{Version}\""
20+
}
21+
]

src/main/scala/net/cardnell/mkver/Main.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Main(git: Git.Service = Git.Live.git()) {
6969
val regex = patch.find.r
7070
val replacement = Formatter(nextVersion, config).format(patch.replace)
7171
patch.filePatterns.foreach { filePattern =>
72-
File.currentWorkingDirectory.glob(filePattern, includePath = false).foreach { file =>
72+
File.currentWorkingDirectory.glob(filePattern, includePath = true).foreach { file =>
7373
println(s"patching: $file, replacement: $replacement")
7474
val newContent = regex.replaceAllIn(file.contentAsString, replacement)
7575
file.overwrite(newContent)

0 commit comments

Comments
 (0)