build: fix maintenance script replacing too much strings

This commit is contained in:
Telan committed 2021-11-14 21:23:42 +02:00
1 parent fa415ec9e6
commit ea29d6853b
2 files changed
+6 -6

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
if [ ! -z $(git diff --name-only HEAD HEAD~1 | grep build.gradle) ]; then
new_version="$(git log -n1 --format=format:"%H")"
sed --in-place "s!//version:.*!//version: $new_version!g" build.gradle
sed --in-place "s!//^version:.*!//version: $new_version!g" build.gradle
git add build.gradle
git commit -m "[ci skip] update build script version to $new_version"
git push
+5 -5
View File
@@ -1,4 +1,4 @@
//version: b61969b80aa3f0b5eab40e92bf943011395d0114
//version: b61969b80aa3f0b5eab40e92bf943011395d0114ssssss
/*
DO NOT CHANGE THIS FILE!
@@ -52,10 +52,10 @@ if(JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current())
}
String getVersionHash(String buildScriptContent) {
String[] lines = buildScriptContent.split("\n")
if(lines.size() > 0 && lines[0].startsWith("//version: b61969b80aa3f0b5eab40e92bf943011395d0114
return lines[0].substring(11)
static String getVersionHash(String buildScriptContent) {
String versionLine = buildScriptContent.find("^//version: [a-z0-9]*")
if(versionLine != null) {
return versionLine.split(": ").last()
}
return ""
}