Skip to content

Commit ffde55d

Browse files
committed
Update RoboFile.php
1 parent 63db780 commit ffde55d

1 file changed

Lines changed: 17 additions & 23 deletions

File tree

RoboFile.php

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,35 @@
1010
*/
1111
class RoboFile extends Tasks
1212
{
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
1714
{
15+
$this->say($what);
1816
$result = $this->taskSemVer()
19-
->increment($opt['what'])
17+
->increment($what)
2018
->run();
2119

2220
$tag = $result->getMessage();
2321

2422
$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);
3524
}
3625

3726
/**
3827
* @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
4130
*/
42-
public function publishGit($branch = null, $opt = ['tag' => null])
31+
public function createTag($branch = '', $tag = '')
4332
{
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();
4943
}
5044
}

0 commit comments

Comments
 (0)