- function listReleaseAssets($repo, $id, callable $callback) {
- $call = new API\Releases\ListReleaseAssets($this, compact("repo", "id"));
- return $call($callback);
+ function listReleaseAssets($repo, $id) {
+ return $this->queue(new API\Releases\ListReleaseAssets($this, compact("repo", "id")));
+ }
+
+ function uploadAssetForRelease($repo, $release, $config = null) {
+ return $this->listHooks($repo->full_name)->then(function($result) use($release, $repo, $config) {
+ list($repo->hooks) = $result;
+ $phar = new Pharext\Package(
+ $repo->clone_url,
+ $release->tag_name,
+ $repo->name,
+ $config ?: (array) $this->checkRepoHook($repo)->config
+ );
+ $name = $phar->build();
+ $url = uri_template($release->upload_url, compact("name"));
+ $promise = $this->createReleaseAsset($url, $phar, "application/phar");
+ if ($release->draft) {
+ return $promise->then(function($result) use($release, $repo) {
+ return $this->publishRelease($repo->full_name, $release->id, $release->tag_name);
+ });
+ }
+ return $promise;
+ });