b0cc468155
- RepositorySynchronizer defaults to GiteaAdapter - PlatformAdapterFactory points to git.mokoconsulting.tech - All plugins reference .gitea/workflows instead of .github/workflows - push_files.php uses Gitea API - Common.php REPO URLs updated to Gitea - sync_dolibarr_readmes.php updated to Gitea URLs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
64 lines
1.7 KiB
PHP
64 lines
1.7 KiB
PHP
#!/usr/bin/env php
|
|
<?php
|
|
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*
|
|
* FILE INFORMATION
|
|
* DEFGROUP: MokoStandards.CLI
|
|
* INGROUP: MokoStandards
|
|
* REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-API
|
|
* PATH: /cli/version_bump.php
|
|
* VERSION: 04.06.00
|
|
* BRIEF: Auto-increment patch version in README.md — outputs old → new
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
$path = '.';
|
|
$type = 'patch'; // patch | minor | major
|
|
foreach ($argv as $i => $arg) {
|
|
if ($arg === '--path' && isset($argv[$i + 1])) $path = $argv[$i + 1];
|
|
if ($arg === '--minor') $type = 'minor';
|
|
if ($arg === '--major') $type = 'major';
|
|
}
|
|
|
|
$readme = realpath($path) . '/README.md';
|
|
if (!file_exists($readme)) {
|
|
fwrite(STDERR, "No README.md found at {$path}\n");
|
|
exit(1);
|
|
}
|
|
|
|
$content = file_get_contents($readme);
|
|
if (!preg_match('/^(\s*VERSION:\s*)(\d{2})\.(\d{2})\.(\d{2})/m', $content, $m)) {
|
|
fwrite(STDERR, "No VERSION field found in README.md\n");
|
|
exit(1);
|
|
}
|
|
|
|
$major = (int)$m[2];
|
|
$minor = (int)$m[3];
|
|
$patch = (int)$m[4];
|
|
$old = sprintf('%02d.%02d.%02d', $major, $minor, $patch);
|
|
|
|
switch ($type) {
|
|
case 'major': $major++; $minor = 0; $patch = 0; break;
|
|
case 'minor': $minor++; $patch = 0; break;
|
|
default:
|
|
$patch++;
|
|
if ($patch > 99) { $minor++; $patch = 0; }
|
|
if ($minor > 99) { $major++; $minor = 0; }
|
|
break;
|
|
}
|
|
|
|
$new = sprintf('%02d.%02d.%02d', $major, $minor, $patch);
|
|
$updated = preg_replace(
|
|
'/^(\s*VERSION:\s*)\d{2}\.\d{2}\.\d{2}/m',
|
|
'${1}' . $new,
|
|
$content,
|
|
1
|
|
);
|
|
|
|
file_put_contents($readme, $updated);
|
|
echo "{$old} → {$new}\n";
|
|
exit(0);
|