Fetch packages from both stable and unstable packages

parent 4ce1e5f6
......@@ -7,16 +7,22 @@ function get_bintray_files_cache($force = false)
$cache_expired = !file_exists($cache_file) || (time() - filemtime($cache_file) >= $cache_time);
if ($force || $cache_expired) {
$files_json = file_get_contents(sprintf(
'https://%s:%s@api.bintray.com/packages/borg-binary-builder/borg-binaries/borg-binaries/files',
$api_url = sprintf(
'https://%1$s:%2$s@api.bintray.com/packages/borg-binary-builder/borg-binaries/%%s/files',
getenv('BINTRAY_USERNAME'),
getenv('BINTRAY_API_KEY')
));
);
// Fallback to cached file if the new files couldn't be fetched.
if ($files_json !== false) {
file_put_contents($cache_file, $files_json);
return json_decode($files_json, false);
$files_stable = json_decode(file_get_contents(sprintf($api_url, 'stable')), true) ?: [];
$files_unstable = json_decode(file_get_contents(sprintf($api_url, 'unstable')), true) ?: [];
$all_files_json = json_encode(array_merge($files_stable, $files_unstable));
// Write new files to cache, or fallback to cached file if the new files couldn't be fetched.
if (!empty($files_stable)) {
file_put_contents($cache_file, $all_files_json);
return json_decode($all_files_json, false);
}
}
......@@ -49,7 +55,7 @@ function save_binaries_json($files, $version)
}
$binaries = [];
foreach (['armv5', 'armv6', 'arm64'] as $flavor) {
foreach (['armv5', 'armv6', 'armv7', 'arm64'] as $flavor) {
$binary = "borg-{$version}-{$flavor}";
$binaries[$flavor] = [
'version' => $files[$binary]->version,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment