Compare commits
No commits in common. "master" and "v2.1.0" have entirely different histories.
|
@ -1,28 +0,0 @@
|
||||||
name: Publish PHP Package
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Get tag name
|
|
||||||
run: echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: zip and send
|
|
||||||
run: |
|
|
||||||
ls -la
|
|
||||||
apt-get update -y
|
|
||||||
apt-get install -y zip
|
|
||||||
cd ../
|
|
||||||
zip -r ${{ gitea.event.repository.name }}.zip ${{ gitea.event.repository.name }} -x '*.git*'
|
|
||||||
curl -v \
|
|
||||||
--user composer-pbl:${{ secrets.COMPOSER_PSWD }} \
|
|
||||||
--upload-file ${{ gitea.event.repository.name }}.zip \
|
|
||||||
https://git.bit5.ru/api/packages/bit/composer?version=${{ env.TAG }}
|
|
|
@ -23,34 +23,27 @@ task('composer', function(array $args) {
|
||||||
composer_run($args);
|
composer_run($args);
|
||||||
});
|
});
|
||||||
|
|
||||||
task('composer_vendor_push', function(array $args) {
|
task('composer_vendor_push', function($args) {
|
||||||
|
|
||||||
$usage = "Usage: ./gamectl composer_vendor_push <path/to/repo> <commit message> [^[^[^]]]\n";
|
$usage = "Usage: ./gamectl composer_vendor_push <path/to/repo> <commit message> [^[^[^]]]\n";
|
||||||
|
|
||||||
$dry_run = arg_opt($args, '--dry-run', false);
|
|
||||||
arg_opt_check_no_trailing($args);
|
|
||||||
|
|
||||||
if(count($args) < 2)
|
if(count($args) < 2)
|
||||||
throw new Exception($usage);
|
throw new Exception($usage);
|
||||||
|
|
||||||
$force_new_tag = '';
|
|
||||||
$up_mode = 1;
|
$up_mode = 1;
|
||||||
if(count($args) > 2)
|
if(count($args) > 2)
|
||||||
{
|
{
|
||||||
$tmp_arg = array_pop($args);
|
if($args[2] === '^')
|
||||||
|
|
||||||
if($tmp_arg === '^')
|
|
||||||
$up_mode = 1;
|
$up_mode = 1;
|
||||||
else if($tmp_arg === '^^')
|
else if($args[2] === '^^')
|
||||||
$up_mode = 2;
|
$up_mode = 2;
|
||||||
else if($tmp_arg === '^^^')
|
else if($args[2] === '^^^')
|
||||||
$up_mode = 3;
|
$up_mode = 3;
|
||||||
else
|
else
|
||||||
$force_new_tag = $tmp_arg;
|
throw new Exception("Invalid up mode: {$args[2]} (supported ^, ^^ and ^^^)");
|
||||||
}
|
}
|
||||||
|
|
||||||
$relpath = array_shift($args);
|
$relpath = $args[0];
|
||||||
$commit_msg = array_shift($args);
|
$commit_msg = $args[1];
|
||||||
$repo = realpath("composer" .DIRECTORY_SEPARATOR. "vendor" .DIRECTORY_SEPARATOR. $relpath) ?: realpath($relpath);
|
$repo = realpath("composer" .DIRECTORY_SEPARATOR. "vendor" .DIRECTORY_SEPARATOR. $relpath) ?: realpath($relpath);
|
||||||
|
|
||||||
if(!$repo)
|
if(!$repo)
|
||||||
|
@ -58,7 +51,7 @@ task('composer_vendor_push', function(array $args) {
|
||||||
|
|
||||||
echo "Detected folder: '$repo'\n";
|
echo "Detected folder: '$repo'\n";
|
||||||
|
|
||||||
if(!git_is_repo($repo, true))
|
if(!git_is_repo($repo))
|
||||||
throw new Exception("'$repo' is not a valid Git repo!\n");
|
throw new Exception("'$repo' is not a valid Git repo!\n");
|
||||||
|
|
||||||
echo "It's a valid Git repo\n";
|
echo "It's a valid Git repo\n";
|
||||||
|
@ -70,63 +63,13 @@ task('composer_vendor_push', function(array $args) {
|
||||||
echo "========\n";
|
echo "========\n";
|
||||||
|
|
||||||
$last_remote_tag = get_git_last_remote_tag($repo);
|
$last_remote_tag = get_git_last_remote_tag($repo);
|
||||||
if($last_remote_tag === false)
|
|
||||||
throw new Exception("Could not retrieve last remote tag");
|
|
||||||
echo "The last remote Git tag: $last_remote_tag\n";
|
echo "The last remote Git tag: $last_remote_tag\n";
|
||||||
|
$last_remote_version = GitVersion::parse($last_remote_tag);
|
||||||
|
|
||||||
if(empty($force_new_tag))
|
$last_remote_version->bump($up_mode);
|
||||||
{
|
echo "New version expected to be: {$last_remote_version->encode()}\n";
|
||||||
$last_remote_version = GitVersion::parse($last_remote_tag);
|
|
||||||
$last_remote_version->bump($up_mode);
|
|
||||||
$new_tag = $last_remote_version->encode();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$new_tag = $force_new_tag;
|
|
||||||
|
|
||||||
echo "Commit message: {$commit_msg}\n";
|
are_you_sure();
|
||||||
echo "New version expected to be: {$new_tag}\n";
|
|
||||||
|
|
||||||
if($dry_run === false)
|
|
||||||
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";
|
|
||||||
|
|
||||||
if($dry_run === false)
|
|
||||||
{
|
|
||||||
are_you_sure();
|
|
||||||
|
|
||||||
$upm_info['version'] = $upm_new_version;
|
|
||||||
upm_set_package_info($repo, $upm_info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($dry_run !== false)
|
|
||||||
{
|
|
||||||
echo "Dry run is done.\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
git_do($repo, 'add .');
|
git_do($repo, 'add .');
|
||||||
git_do($repo, "commit -am \"$commit_msg\"", $commit_output);
|
git_do($repo, "commit -am \"$commit_msg\"", $commit_output);
|
||||||
|
@ -152,14 +95,9 @@ task('composer_vendor_push', function(array $args) {
|
||||||
$last_tag = _get_last_version_tag($tags);
|
$last_tag = _get_last_version_tag($tags);
|
||||||
echo "Last tag: $last_tag\n";
|
echo "Last tag: $last_tag\n";
|
||||||
|
|
||||||
if(empty($force_new_tag))
|
$last_version = GitVersion::parse($last_tag);
|
||||||
{
|
$last_version->bump($up_mode);
|
||||||
$last_version = GitVersion::parse($last_tag);
|
$new_tag = $last_version->encode();
|
||||||
$last_version->bump($up_mode);
|
|
||||||
$new_tag = $last_version->encode();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$new_tag = $force_new_tag;
|
|
||||||
|
|
||||||
echo "New tag: $new_tag\n";
|
echo "New tag: $new_tag\n";
|
||||||
|
|
||||||
|
@ -207,11 +145,7 @@ task('composer_vendor_status', function(array $args) {
|
||||||
if($status)
|
if($status)
|
||||||
{
|
{
|
||||||
$package = str_replace(normalize_path("$GAME_ROOT/composer/vendor/"), '', normalize_path($item));
|
$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' 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";
|
echo implode("\n", $status) . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue