-
-
Save mageddo/c5c828594f91679ea47a42e6906b0d4d to your computer and use it in GitHub Desktop.
updating version at a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
confirmReleaseVersion.doLast { | |
println "> upgrading docker-compose version=${project.version}" | |
def versionPattern = "\\d+\\.\\d+\\.\\d+(?:-beta|-snapshot|-alpha)?" | |
updateVersion("README.md", "/${versionPattern}/", "/${version}/") | |
updateVersion("docker-compose.yml", "(image:.*:)(.*)", "\$1${project.version}") | |
def sout = new StringBuilder() | |
def proc = ['git', 'commit', '-a', "-m [Gradle Release Plugin] - releasing '${project.version}'."].execute() | |
proc.consumeProcessOutput(sout, sout) | |
proc.waitForOrKill(3000) | |
println "> $sout" | |
} | |
void updateVersion(f, pattern, replace){ | |
f = file("${project.projectDir}}/${f}") | |
println "> updating version in: ${f}" | |
if(!f.exists()){ | |
println "file ${f} not found" | |
System.exit(-1) | |
} | |
f.write(f.text.replaceAll(pattern, replace)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment