mirror of
https://github.com/koel/koel
synced 2024-11-14 00:17:13 +00:00
feat: ensure current branch is master
for release
This commit is contained in:
parent
a86c2ab654
commit
d6053e931a
1 changed files with 12 additions and 0 deletions
|
@ -25,6 +25,7 @@ class ReleaseCommand extends Command
|
|||
|
||||
public function handle(): int
|
||||
{
|
||||
self::ensureMainBranch();
|
||||
self::ensureCleanWorkingDirectory();
|
||||
|
||||
$this->getCurrentVersion();
|
||||
|
@ -134,6 +135,17 @@ class ReleaseCommand extends Command
|
|||
note('Current version: ' . $this->currentVersion->prefix());
|
||||
}
|
||||
|
||||
private static function ensureMainBranch(): void
|
||||
{
|
||||
$branch = trim(Process::run('git branch --show-current')->output());
|
||||
|
||||
if ($branch !== 'master') {
|
||||
error("You must be on the master branch to release a new version (Current branch: '$branch.')");
|
||||
|
||||
exit(self::FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
private static function ensureCleanWorkingDirectory(): void
|
||||
{
|
||||
if (Process::run('git status --porcelain')->output()) {
|
||||
|
|
Loading…
Reference in a new issue