In my CI setup I run tests in a separate stage and only if they pass I'd want to run a task that sets the version and creates the tag. If I run ./gradlew final or ./gradlew release, the Java build and tests run again. Do I just need to write custom logic to stop the build task from running when I run final or release?