axion-release-plugin
axion-release-plugin copied to clipboard
postRelease hook
Hi Team,
We are trying to use postRelease hook to update the version in readMe with latest version which is just released. Below is the code, I have taken from examples,
`
scmVersion {
useHighestVersion.set(true)
tag {
initialVersion { _, _ -> "0.1.2" }
}
checks {
snapshotDependencies.set(true)
uncommittedChanges.set(false)
aheadOfRemote.set(false)
}
repository {
pushTagsOnly.set(true)
}
hooks {
postRelease {
push()
commit { releaseVersion, position -> "New commit message for version $releaseVersion" }
custom { context -> println("$context")}
fileUpdate {
file("README.md") // repeat for additional files
pattern = {previousVersion,context -> "version: $previousVersion"}
replacement = {currentVersion,context -> "version: $currentVersion"}
}
}
}
} `
error :
` Execution failed for task ':release'.
Cannot invoke "Object.toString()" because the return value of "pl.allegro.tech.build.axion.release.domain.hooks.ReleaseHookFactory$CustomAction.apply(pl.allegro.tech.build.axion.release.domain.hooks.HookContext)" is null `
We are experiencing something similar. (For pre)
The way docs describe the scmVersion.hooks.pre is not valid kotlin. And will not compile. You have to specify something like you write, and I haven't gotten it to work at all. Atm I'm getting ClassLoader issues both on gradle 7.6 and gradle 8.3
I have not been able to test the hook at all. And just a way to do that would be nice; maybe dryRun is the thing to do, maybe not. I can't really tell from the docs.