Add support for building specific version
* Improve version resolution logic. * Allow providing a specific version when building package.
This commit is contained in:
@@ -11,6 +11,7 @@ use NoccyLabs\Composer\PackagePlugin\Project\ProjectInfo;
|
||||
use NoccyLabs\Composer\PackagePlugin\Registry\Credentials\InsecureStore;
|
||||
use NoccyLabs\Composer\PackagePlugin\Registry\Gitea\GiteaProvider;
|
||||
use NoccyLabs\Composer\PackagePlugin\Registry\RegistryFactory;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class PackageBuildCommand extends BaseCommand
|
||||
@@ -25,6 +26,7 @@ class PackageBuildCommand extends BaseCommand
|
||||
->addOption("rm", null, InputOption::VALUE_NONE, "With --publish: remove the .zip after publishing")
|
||||
->addOption("dirty", null, InputOption::VALUE_NONE, "Build directly from source without cloning")
|
||||
->addOption("force", null, InputOption::VALUE_NONE, "Build even if the output file already exists")
|
||||
->addArgument("version", InputArgument::OPTIONAL, "The tag to build (default is latest tag)")
|
||||
;
|
||||
}
|
||||
|
||||
@@ -34,7 +36,9 @@ class PackageBuildCommand extends BaseCommand
|
||||
|
||||
$builder = new PackageBuilder($output);
|
||||
|
||||
$project = ProjectInfo::read();
|
||||
$version = $input->getArgument("version");
|
||||
|
||||
$project = ProjectInfo::read(version:$version);
|
||||
|
||||
if ($registry && file_exists($project->filename) && !$input->getOption("force")) {
|
||||
$output->writeln("<fg=black;bg=yellow>Package file already exists. Pass --force to rebuild it.</>");
|
||||
|
||||
Reference in New Issue
Block a user