Adding basic support for UPM packages into composer_vendor_push
Publish PHP Package / docker (push) Successful in 5s Details

This commit is contained in:
Pavel Shevaev 2024-09-26 18:25:57 +03:00
parent 8ae4cff800
commit c703ffd95b
1 changed files with 36 additions and 2 deletions

View File

@ -69,10 +69,41 @@ task('composer_vendor_push', function($args) {
$last_remote_version = GitVersion::parse($last_remote_tag);
$last_remote_version->bump($up_mode);
echo "New version expected to be: {$last_remote_version->encode()}\n";
$new_tag = $last_remote_version->encode();
echo "New version expected to be: {$new_tag}\n";
are_you_sure();
$is_upm = file_exists("$repo/package.json");
if($is_upm)
{
echo "This looks like an UPM package, let's update the package.json?\n";
if(are_you_sure_ask())
{
if(!function_exists('taskman\upm_get_package_info'))
{
echo "Can't proceed, composer 'bit/taskman_upm' package is missing\n";
exit(1);
}
$upm_info = upm_get_package_info($repo);
if(!isset($upm_info['name']))
throw new Exception("'name' is not present in package.json");
if(!isset($upm_info['version']))
throw new Exception("'version' is not present in package.json");
$upm_version = $upm_info['version'];
echo "Current package.json version is: {$upm_version}\n";
$upm_new_version = ltrim($new_tag, 'v');
echo "New package.json expected to be: {$upm_new_version}\n";
are_you_sure();
$upm_info['version'] = $upm_new_version;
upm_set_package_info($repo, $upm_info);
}
}
git_do($repo, 'add .');
git_do($repo, "commit -am \"$commit_msg\"", $commit_output);
$rev = git_rev_from_commit_message(trim($commit_output[0]));
@ -148,7 +179,10 @@ task('composer_vendor_status', function(array $args) {
{
$package = str_replace(normalize_path("$GAME_ROOT/composer/vendor/"), '', normalize_path($item));
$last_remote_tag = get_git_last_remote_tag($item);
echo "==== Vendor package '$package'[$last_remote_tag] changes:\n";
echo "==== Vendor package '$package'[$last_remote_tag] changes";
if(is_file($item . '/package.json'))
echo " (UPM package?)";
echo ":\n";
echo implode("\n", $status) . "\n";
}
}