'Update a source Docker image with environment config and publish it to deis-registry.'

def publish_release(self, source, config, target, deis_registry):

    (src_name, src_tag) = docker.utils.parse_repository_tag(source)
    (name, tag) = docker.utils.parse_repository_tag(target)
    name = strip_prefix(name)
    if deis_registry:
        repo = u'{}/{}'.format(self.registry, src_name)
    else:
        repo = src_name
    self.pull(repo, src_tag)
    image = u'{}:{}'.format(repo, src_tag)
    self.tag(image, src_name, tag=src_tag)
    config.update({u'DEIS_APP': name, u'DEIS_RELEASE': tag})
    self.build(source, config, name, tag)
    self.push(u'{}/{}'.format(self.registry, name), tag)
