| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace DebenOldert\AutoDeploy;
- include 'action.class.php';
- class ReleaseAction extends Action
- {
- public function shouldDownload() : bool
- {
- return (!$this->json->release->draft
- && !$this->json->release->prerelease)
- || ($this->settings['acceptDraft']
- && $this->json->release->draft)
- || ($this->settings['acceptPre']
- && $this->json->release->prerelease);
- }
- public function formatDownloadName() : string
- {
- return "{$this->settings['download_dir']}/{$this->json->repository->name}-{$this->json->release->tag_name}.zip";
- }
- public function formatUnZipName() : string
- {
- return "{$this->settings['download_dir']}/{$this->json->repository->name}-{$this->json->release->tag_name}";
- }
- public function formatUrl() : string
- {
- $parsed = parse_url($this->json->repository->html_url);
- $domain = "{$parsed['scheme']}://{$parsed['host']}";
- return "{$domain}/api/v1/repos/{$this->json->repository->owner->username}/{$this->json->repository->name}/archive/{$this->json->release->tag_name}.zip?token={$this->key}";
- }
- public function formatRealName() : string
- {
- return include_once "{$this->unzipName}/base.class.php";
- }
- }
|