//Compile and publish a stand-alone release
task prepareFullRelease << {
  def command = "mkdir -p ~/wwwroot/full/${versionString}"
  runSshExecOnBuildServer(command)
}

task uploadFullRelease << {
  def host     = "butatopanto.de"
  def dir      = "/home/anathema/wwwroot/full"
  def keyfile  = findKeyFile()
  def passphrase = usePropertyOrPrompt('anathemaPassphrase', "Anathema SSH Key Passphrase")
  def connectString = "anathema@${host}:${dir}/${versionString}"
  scp(connectString, keyfile, passphrase) {
    ant.fileset(dir: releaseDir)
  }
}

task finishFullRelease << {
  def command = "echo ${versionString} >> ~/wwwroot/full/availableVersions"
  runSshExecOnBuildServer(command)
}

task publishAsFullRelease

publishAsFullRelease.group = 'Release'
publishAsFullRelease.description = "Builds & uploads the release's artifacts to Anathema's update server. [Requires registered credentials]"

prepareFullRelease.dependsOn "build"
uploadFullRelease.dependsOn prepareFullRelease
finishFullRelease.dependsOn uploadFullRelease
publishAsFullRelease.dependsOn finishFullRelease