Skip to content

Commit

Permalink
event deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
falOn-Dev committed Oct 19, 2024
1 parent ebe1853 commit a21b6c6
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,38 @@ gversion {
annotate = false // optional. Java only. Adds @Generated annotation
}

task(eventDeploy) {
doLast {
if (project.gradle.startParameter.taskNames.any({ it.toLowerCase().contains("deploy") })) {

def branchPrefix = "event"
def branch = 'git branch --show-current'.execute().text.trim()
def commitMessage = "Update at '${new Date().toString()}'"

if (branch.startsWith(branchPrefix)) {
exec {
workingDir(projectDir)
executable 'git'
args 'add', '-A'
}
exec {
workingDir(projectDir)
executable 'git'
args 'commit', '-m', commitMessage
ignoreExitValue = true
}

println "Committed to branch: '$branch'"
println "Commit message: '$commitMessage'"
} else {
println "Not on an event branch, skipping commit"
}
} else {
println "Not running deploy task, skipping commit"
}
}
}
createVersionFile.dependsOn(eventDeploy)

java {
}
Expand Down

0 comments on commit a21b6c6

Please sign in to comment.