always verify version in composer.json matches release tag, before creating archives

This commit is contained in:
ralf 2024-10-17 08:34:27 +02:00
parent 65caab5c06
commit a0a06f9fb6

View File

@ -1181,6 +1181,16 @@ function do_copy()
// we need to stash uncommited changes, before copying // we need to stash uncommited changes, before copying
if (file_exists($config['checkoutdir'].'/.git')) run_cmd("cd $config[checkoutdir]; git stash"); if (file_exists($config['checkoutdir'].'/.git')) run_cmd("cd $config[checkoutdir]; git stash");
// verify version in composer.json matches release-tag
if (!($json = file_get_contents($path=$config['checkoutdir'].'/composer.json')) || !($json = json_decode($json, true)) || !is_array($json))
{
throw new Exception("Can NOT read $path to verify version!");
}
if ($json['version'] !== $config['version'])
{
throw new Exception("Version in composer.json does not match: '$json[version]' !== '$config[version] --> aborting!");
}
try { try {
$cmd = '/usr/bin/rsync -r --delete --delete-excluded --exclude .svn --exclude .git\* --exclude tests '.$config['checkoutdir'].'/ '.$config['egw_buildroot'].'/'.$config['aliasdir'].'/'; $cmd = '/usr/bin/rsync -r --delete --delete-excluded --exclude .svn --exclude .git\* --exclude tests '.$config['checkoutdir'].'/ '.$config['egw_buildroot'].'/'.$config['aliasdir'].'/';
run_cmd($cmd); run_cmd($cmd);