protected function getReleaseId($releaseName)
    {
        $releaseId = null;
        $releaseNames = array();
        $releases = $this->client->api('repo')->releases()->all(
            $this->owner,
            $this->repository
        );
        foreach ($releases as $release) {
            if ($release['name'] == $releaseName) {
                $releaseId = $release['id'];
            }
            $releaseNames[] = $release['name'];
        }

        if (empty($releaseId)) {
            throw new BuildException(sprintf(
                'Unable to determine release id for name "%s". Valid release names: "%s"',
                $releaseName,
                implode('", "', $releaseNames)
            ));
        }

        return $releaseId;
    }