setName('package:publish') ->setDescription("Publish a package to a composer package registry") ->addArgument("registry", InputArgument::OPTIONAL, "The registry to publish to") ; } protected function execute(InputInterface $input, OutputInterface $output): int { $credentials = new InsecureStore(); $providers = [ 'gitea' => new GiteaProvider($credentials) ]; $registry = new RegistryFactory($providers); $publisher = new PackagePublisher($registry, $output); $project = ProjectInfo::read(); $registry = $input->getArgument("registry"); if (!$registry) { $output->writeln([ "Missing registry to publish to. Please specify the registry like this:", "", " gitea: - to publish to server as the default user", " gitea:/ - to publish to server as owner", "" ]); return self::INVALID; } $publisher->publish($project, $registry); return 0; } }