faster version fetch script

This commit is contained in:
Nemo 2022-02-02 18:47:50 +05:30
parent 351250d2a3
commit 1931e40778
1 changed files with 3 additions and 7 deletions

View File

@ -5,13 +5,12 @@ const VERSION_EXCLUDE = ['nightly', 'beta', 'alpha'];
// till May 2022, after which only 3 major versions will be supported
const SUPPORTED_MAJOR_VERSIONS = [14, 15, 16, 17];
// Command to fetch the list of versions from upstream
const FETCH_VERSIONS_COMMAND = "git ls-remote -q --tags https://github.com/electron/electron.git |grep -v '\^{}' |cut -f2 | sed -s 's/refs\/tags\///g' ";
function get_versions() {
`rm -rf electron-src`;
`git clone https://github.com/electron/electron.git electron-src`;
chdir("electron-src");
$versions = [];
foreach(explode("\n", shell_exec("git tag -l")) as $version) {
foreach(explode("\n", shell_exec(FETCH_VERSIONS_COMMAND)) as $version) {
foreach(VERSION_EXCLUDE as $needle) {
if (stripos($version, $needle) !== false) {
continue 2;
@ -25,9 +24,6 @@ function get_versions() {
$versions[] = $version;
}
chdir("..");
`rm -rf electron-src`;
return $versions;
}