|
10 | 10 | */ |
11 | 11 | class RoboFile extends Tasks |
12 | 12 | { |
13 | | - public function release(ConsoleIO $io, $opt = [ |
14 | | - 'branch|b' => 'main', |
15 | | - 'what|w' => 'patch' |
16 | | - ]): void |
| 13 | + public function release($branch = 'master', $what = 'patch'): void |
17 | 14 | { |
| 15 | + $this->say($what); |
18 | 16 | $result = $this->taskSemVer() |
19 | | - ->increment($opt['what']) |
| 17 | + ->increment($what) |
20 | 18 | ->run(); |
21 | 19 |
|
22 | 20 | $tag = $result->getMessage(); |
23 | 21 |
|
24 | 22 | $this->say("Releasing $tag"); |
25 | | - |
26 | | - $this->clean($io); |
27 | | - $this->publishGit($opt['branch'], ['tag' => $tag]); |
28 | | - } |
29 | | - |
30 | | - public function clean(ConsoleIO $io): void |
31 | | - { |
32 | | - $io->say('Cleaning up'); |
33 | | - $this->taskCleanDir(['logs'])->run(); |
34 | | - $this->taskDeleteDir('logs')->run(); |
| 23 | + $this->createTag($branch, $tag); |
35 | 24 | } |
36 | 25 |
|
37 | 26 | /** |
38 | 27 | * @desc creates a new version tag and pushes to GitHub |
39 | | - * @param null $branch |
40 | | - * @param array $opt |
| 28 | + * @param string $branch |
| 29 | + * @param string $tag |
41 | 30 | */ |
42 | | - public function publishGit($branch = null, $opt = ['tag' => null]) |
| 31 | + public function createTag($branch = '', $tag = '') |
43 | 32 | { |
44 | | - $this->say('Pushing ' . $opt['tag'] . ' to GitHub'); |
45 | | - $this->taskExec('git tag ' . $opt['tag']) |
46 | | - ->run(); |
47 | | - $this->taskExec("git push origin $branch --tags") |
48 | | - ->run(); |
| 33 | + $this->say("Creating tag $tag on origin::$branch"); |
| 34 | + |
| 35 | + $this->taskGitStack() |
| 36 | + ->stopOnFail() |
| 37 | + ->add('.semver') |
| 38 | + ->commit('Update version') |
| 39 | + ->push('origin', $branch) |
| 40 | + ->tag($tag) |
| 41 | + ->push('origin', $tag) |
| 42 | + ->run(); |
49 | 43 | } |
50 | 44 | } |
0 commit comments