make what get's uploaded configurable and allow to run upload alone

This commit is contained in:
Ralf Becker 2016-06-06 17:14:02 +02:00
parent e03c84f948
commit 09e9f81545

View File

@ -65,6 +65,8 @@ $config = array(
'editchangelog' => '* ', 'editchangelog' => '* ',
//'sfuser' => 'ralfbecker', //'sfuser' => 'ralfbecker',
//'release' => '$sfuser,egroupware@frs.sourceforge.net:/home/frs/project/e/eg/egroupware/eGroupware-$version/eGroupware-$version.$packaging/', //'release' => '$sfuser,egroupware@frs.sourceforge.net:/home/frs/project/e/eg/egroupware/eGroupware-$version/eGroupware-$version.$packaging/',
// what gets uploaded with upload
'upload' => '$sourcedir/*egroupware-epl{,-contrib}-$version.$packaging*',
'copychangelog' => '$sourcedir/README', //'$sfuser,egroupware@frs.sourceforge.net:/home/frs/project/e/eg/egroupware/README', 'copychangelog' => '$sourcedir/README', //'$sfuser,egroupware@frs.sourceforge.net:/home/frs/project/e/eg/egroupware/README',
'skip' => array(), 'skip' => array(),
'run' => array('checkout','editchangelog','tag','copy','virusscan','create','sign','obs','copychangelog'), 'run' => array('checkout','editchangelog','tag','copy','virusscan','create','sign','obs','copychangelog'),
@ -382,9 +384,26 @@ function do_release()
'body' => $config['changelog'], 'body' => $config['changelog'],
); );
$response = github_api("/repos/EGroupware/egroupware/releases", $data); $response = github_api("/repos/EGroupware/egroupware/releases", $data);
$upload_url = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']); // remove {?name,label} template $config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']); // remove {?name,label} template
$archives = $config['sourcedir'].'/*egroupware-epl{,-contrib}-'.$config['version'].'.'.$config['packaging'].'*'; do_upload();
}
/**
* Upload archives
*/
function do_upload()
{
global $config,$verbose;
if (empty($config['upload_url']))
{
$response = github_api("/repos/EGroupware/egroupware/releases", array(), 'GET');
$config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response[0]['upload_url']); // remove {?name,label} template
}
$archives = config_translate('upload');
echo "Uploading $archives\n";
foreach(glob($archives) as $path) foreach(glob($archives) as $path)
{ {
@ -410,8 +429,9 @@ function do_release()
{ {
continue; continue;
} }
if ($verbose) echo "Uploading $path as $content_type\n";
$name = basename($path); $name = basename($path);
github_api($upload_url, array( github_api($config['upload_url'], array(
'name' => $name, 'name' => $name,
'label' => isset($label) ? $label : $name, 'label' => isset($label) ? $label : $name,
), 'FILE', $path, $content_type); ), 'FILE', $path, $content_type);