Skip to content

Commit

Permalink
updating workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
agracio committed Jan 23, 2025
1 parent e761aa5 commit 23f1863
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions tools/getVersions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const fs = require("fs");
const http = require('isomorphic-git/http/web');
const git = require("isomorphic-git");
const { get } = require("https");

const majors = [29, 30, 31, 32, 33, 34];

Expand All @@ -10,35 +9,41 @@ git.getRemoteInfo({
//corsProxy: "https://cors.isomorphic-git.org",
url: "https://github.com/electron/electron"
}).then(info =>{
let result = Object.keys(info.refs.tags);

let tags = Object.keys(info.refs.tags);
let oses = ['macos-13', 'macos-14', 'ubuntu-22.04', 'ubuntu-22.04-arm', 'windows-2022'];
let versions = [];
let results = [];

majors.forEach((major) => {

oses.forEach((os) => {
versions.push({'electron': getVersion(result, major), 'os': `${os}`});
versions.push(getVersion(tags, major));
});

oses.forEach((os) => {
versions.forEach((version) => {
results.push({'electron': `${version}`, 'os': `${os}`});
});
});
let res = `{'include':${JSON.stringify(versions)}}`

let res = `{'include':${JSON.stringify(results)}}`
fs.writeFileSync('electron-versions.txt', res);
console.log(res);
});

function getVersion(result, major){
result = result
function getVersion(tag, major){
tag = tag
.filter(function (str) { return !str.includes('^'); })
.filter(function (str) { return !str.includes('-'); })
.filter(function (str) { return str.startsWith(`v${major}.`); })
.sort()
.reverse();

if(result.length !== 0){
return result[0].replace('v', '')
if(tag.length !== 0){
return tag[0].replace('v', '')
}
else{
throw `Unable to resolve latest version for Electron ${major}`
}

}


Expand Down

0 comments on commit 23f1863

Please sign in to comment.