With the help from sbt
mailing list, I was able to create a solution as follows:
def publishSnapshot = Command.command("publish-snapshot") { state =>
val extracted = Project extract state
import extracted._
val eVersion = getOpt(version).get // getting current version
runTask(publish in Compile,
append(Seq(version := "newVersion"), state),
true
)
state
}