|
@@ -60,35 +60,50 @@ class TagModulesCommand extends Command
|
|
$git->config->add('user.name', 'drone', ["global" => true]);
|
|
$git->config->add('user.name', 'drone', ["global" => true]);
|
|
// agrego el path del repositorio
|
|
// agrego el path del repositorio
|
|
$git->setRepository($git_path);
|
|
$git->setRepository($git_path);
|
|
- // guardo cualquier cambio realizado.
|
|
|
|
- //$git->stash();
|
|
|
|
// necesito traer todos los branch's para ver si ya existe
|
|
// necesito traer todos los branch's para ver si ya existe
|
|
$branchs = $git->branch(['all' => true]);
|
|
$branchs = $git->branch(['all' => true]);
|
|
$findBranch = false;
|
|
$findBranch = false;
|
|
$branchRemote = null;
|
|
$branchRemote = null;
|
|
|
|
+ $branchOrigen = null;
|
|
// verifico si el branch a crear ya existe
|
|
// verifico si el branch a crear ya existe
|
|
foreach ($branchs as $branch) {
|
|
foreach ($branchs as $branch) {
|
|
|
|
+ if ($branch['current']) {
|
|
|
|
+ $branchOrigen = $branch['name'];
|
|
|
|
+ }
|
|
if ($branch['name'] == $version) {
|
|
if ($branch['name'] == $version) {
|
|
$findBranch = true;
|
|
$findBranch = true;
|
|
$branchRemote = $branch['name'];
|
|
$branchRemote = $branch['name'];
|
|
- break;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!$findBranch) {
|
|
if (!$findBranch) {
|
|
// si no existe el branch y estoy creando un branch nuevo
|
|
// si no existe el branch y estoy creando un branch nuevo
|
|
|
|
+ $output->writeln('Creando la rama ' . $version);
|
|
$git->branch->create($version);
|
|
$git->branch->create($version);
|
|
}
|
|
}
|
|
- // cambio a la rama de la version y agrego los archivos modificados
|
|
|
|
- $git->checkout($version);
|
|
|
|
$git->add('composer.json');
|
|
$git->add('composer.json');
|
|
$git->add('composer.lock');
|
|
$git->add('composer.lock');
|
|
|
|
|
|
- shell_exec($cd_path . "; git commit -am 'Composer para la version " . $version . " y el tag " . $tag . "'");
|
|
|
|
- shell_exec($cd_path . "; git push " . $optionRemoteGit . " " . $version );
|
|
|
|
|
|
+ $output->writeln('Commit de los composer');
|
|
|
|
+ $command = $cd_path . "; git commit -am 'Composer para la version " . $version . " y el tag " . $tag . "'";
|
|
|
|
+ $output->writeln('\t' . $command);
|
|
|
|
+ shell_exec($command);
|
|
|
|
+
|
|
|
|
+ // cambio a la rama de la version y agrego los archivos modificados
|
|
|
|
+ $output->writeln('Checkout de la rama ' . $version);
|
|
|
|
+ $git->checkout($version);
|
|
|
|
+
|
|
|
|
+ $output->writeln('Merge entre la rama ' . $version . ' y ' . $branchOrigen);
|
|
|
|
+ $git->merge($branchOrigen, 'Merge entre la rama ' . $version . ' y ' . $branchOrigen, ['strategy' => 'ours']);
|
|
|
|
+
|
|
|
|
+ $output->writeln('Push de la rama ' . $version);
|
|
|
|
+ $command = $cd_path . "; git push " . $optionRemoteGit . " " . $version;
|
|
|
|
+ $output->writeln('\t' . $command);
|
|
|
|
+ shell_exec($command);
|
|
// estoy creando un tag
|
|
// estoy creando un tag
|
|
$tags = $git->tag();
|
|
$tags = $git->tag();
|
|
if (!in_array($tag, $tags)) {
|
|
if (!in_array($tag, $tags)) {
|
|
// el tag no existe
|
|
// el tag no existe
|
|
|
|
+ $output->writeln('Creo el tag: ' . $tag);
|
|
if ($branchRemote == null) {
|
|
if ($branchRemote == null) {
|
|
// el branch remote no existe
|
|
// el branch remote no existe
|
|
$git->tag->create($tag, $version);
|
|
$git->tag->create($tag, $version);
|
|
@@ -98,9 +113,14 @@ class TagModulesCommand extends Command
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// ejecuto el comando git
|
|
// ejecuto el comando git
|
|
- shell_exec($cd_path . "; git push " . $optionRemoteGit . " --tags ");
|
|
|
|
|
|
+ $output->writeln('Push de la rama.');
|
|
|
|
+ $command = $cd_path . "; git push " . $optionRemoteGit . " --tags ";
|
|
|
|
+ $output->writeln('\t' . $command);
|
|
|
|
+ // tengo que hacer el --tags para que pase todos los tags
|
|
|
|
+ shell_exec($command);
|
|
} catch (GitException $e) {
|
|
} catch (GitException $e) {
|
|
$output->writeln("SE PRODUJO UN ERROR EN " . $sec);
|
|
$output->writeln("SE PRODUJO UN ERROR EN " . $sec);
|
|
|
|
+ shell_exec($cd_path . "; git reset ");
|
|
$output->writeln($e->getTraceAsString());
|
|
$output->writeln($e->getTraceAsString());
|
|
$output->writeln($sec . ": " . $e->getMessage());
|
|
$output->writeln($sec . ": " . $e->getMessage());
|
|
return $e->getCode();
|
|
return $e->getCode();
|