3 namespace app\Controller\Github
;
5 use app\Controller\Github
;
6 use app\Github\API\Repos\RepoCallback
;
9 class Release
extends Github
11 function __invoke(array $args = null) {
13 if ($this->checkToken()) {
14 list($repo) = $this->github
->readRepo("$owner/$name", function($repo, $links = null) {
15 call_user_func(new RepoCallback($this->github
), $repo, $links);
17 $this->github
->listReleases($repo->full_name
, null, function($releases) use($repo) {
18 $config = $this->app
->getRequest()->getForm();
19 foreach ($releases as $r) {
20 if ($r->tag_name
=== $config->tag
) {
21 $this->github
->uploadAssetForRelease($repo, $r, $config, function() use($repo) {
22 $this->app
->redirect($this->app
->getBaseUrl()->mod("./github/" . $repo->full_name
));
28 $this->github
->createReleaseFromTag($repo, $tag, $config, function() use($repo) {
29 $this->app
->redirect($this->app
->getBaseUrl()->mod("./github/" . $repo->full_name
));
34 $hook = $this->github
->checkRepoHook($repo);
36 $this->app
->getView()->addData(compact("owner", "name", "repo", "hook"));
38 if (($modal = $this->app
->getRequest()->getQuery("modal"))) {
39 $action = $this->app
->getRequest()->getQuery($modal);
40 $this->app
->getView()->addData(compact("modal", "action"));
43 $this->app
->display("github/repo");