Skip to content

Instantly share code, notes, and snippets.

@mageddo
Created February 28, 2023 03:08
Show Gist options
  • Save mageddo/f5b2939e0119db5cb51adf137b1d74d9 to your computer and use it in GitHub Desktop.
Save mageddo/f5b2939e0119db5cb51adf137b1d74d9 to your computer and use it in GitHub Desktop.
Atualizar arquivos com a versão nova e não com a atual, não gerando tag
plugins {
id "java"
id 'net.researchgate.release' version '3.0.2'
}
release {
project.ext.set("release.useAutomaticVersion", true)
git {
requireBranch.set("")
}
failOnCommitNeeded = true
failOnPublishNeeded = true
failOnUnversionedFiles = true
buildTasks = []
}
// don't create tags as github-cli will do that
preTagCommit.enabled = false
createReleaseTag.enabled = false
confirmReleaseVersion {
doLast {
// codigo com a versao atual...
}
}
tasks.register("updateNewVersion") {
doLast {
updateVersion("README.md", "/\\d+\\.\\d+\\.\\d+/", "/${version}/")
updateVersion("README.md", "\\d+\\.\\d+\\.\\d+\\.tgz", "${version}.tgz")
}
}
tasks["updateVersion"].finalizedBy("updateNewVersion")
def updateVersion(fileName, pattern, version) {
println("> file=${fileName}, pattern=${pattern}, to=${version}")
def f = file("${rootDir}/$fileName")
def text = f.text
f.withWriter { w ->
w << text.replaceAll(pattern, version)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment