+
+ 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;
+ });
+ }
+
+ function createReleaseFromTag($repo, $tag_name, $config = null) {
+ return $this->createRelease($repo->full_name, $tag_name)->then(function($result) use($repo, $config) {
+ list($release) = $result;
+ return $this->uploadAssetForRelease($repo, $release, $config);
+ });
+ }
+