Skip to content

Commit 58becf3

Browse files
committed
switch to checking github tags for php releases
1 parent 7d43328 commit 58becf3

3 files changed

Lines changed: 19 additions & 23 deletions

File tree

.github/workflows/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
<info>
33
<dependencies>
4-
<nextcloud min-version="25" max-version="28" />
4+
<nextcloud min-version="25" max-version="29" />
55
</dependencies>
66
</info>

dist/index.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42555,12 +42555,8 @@ function parseVersionId(raw) {
4255542555
return parseInt(matches[1], 10) / 10 + parseInt(matches[2], 10) / 10
4255642556
}
4255742557

42558-
async function getAllPhpVersions() {
42559-
// again hacky, but gives a nicely always-up-to-date list
42560-
let res = await client.get(`https://www.php.net/releases/`);
42561-
let releasesHtml = await res.readBody();
42562-
let matches = [...releasesHtml.matchAll(/<h2>(\d+\.\d+\.\d+)<\/h2>/g)];
42563-
return matches.map(match => match[1]);
42558+
async function isPhpVersionReleased(version) {
42559+
return await urlExist(`https://github.com/php/php-src/releases/tag/php-${version.toFixed(1)}.0`);
4256442560
}
4256542561

4256642562
async function distroSupportsPhpVersion(version) {
@@ -42629,17 +42625,16 @@ function copy(obj) {
4262942625

4263042626
const versions = range(minVersion, maxVersion);
4263142627

42632-
const versionData= await Promise.all(versions.map(async (version) => {
42628+
// we reverse the order to put highest version first for the "branched off check"
42629+
const versionData= (await Promise.all(versions.reverse().map(async (version) => {
4263342630
const branch = await getBranch(version);
4263442631
const php = await getSupportedVersions(branch);
4263542632
return {
4263642633
"phpMin": php.min,
4263742634
"phpMax": php.max,
4263842635
"branch": branch,
4263942636
}
42640-
}));
42641-
// parseFloat will ignore patch versions, leaving us with all major and minor releases
42642-
const possiblePhpVersions = (await getAllPhpVersions()).map(parseFloat).filter(onlyUnique);
42637+
}))).reverse();
4264342638

4264442639
// matrix with a single php version per server version
4264542640
const serverMatrix = cartesianProduct({
@@ -42662,8 +42657,11 @@ function copy(obj) {
4266242657
for(let version = phpMin; version <= phpMax; version += 0.1) {
4266342658
// floats are a pain
4266442659
version = parseFloat(version.toFixed(1));
42665-
if (possiblePhpVersions.includes(version)) {
42660+
if (await isPhpVersionReleased(version)) {
4266642661
php.push(version.toFixed(1));
42662+
} else {
42663+
// no more minors for this major
42664+
version = Math.ceil(version) - 0.1;
4266742665
}
4266842666
}
4266942667

src/action.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,8 @@ function parseVersionId(raw) {
4141
return parseInt(matches[1], 10) / 10 + parseInt(matches[2], 10) / 10
4242
}
4343

44-
async function getAllPhpVersions() {
45-
// again hacky, but gives a nicely always-up-to-date list
46-
let res = await client.get(`https://www.php.net/releases/`);
47-
let releasesHtml = await res.readBody();
48-
let matches = [...releasesHtml.matchAll(/<h2>(\d+\.\d+\.\d+)<\/h2>/g)];
49-
return matches.map(match => match[1]);
44+
async function isPhpVersionReleased(version) {
45+
return await urlExist(`https://github.com/php/php-src/releases/tag/php-${version.toFixed(1)}.0`);
5046
}
5147

5248
async function distroSupportsPhpVersion(version) {
@@ -115,17 +111,16 @@ function copy(obj) {
115111

116112
const versions = range(minVersion, maxVersion);
117113

118-
const versionData= await Promise.all(versions.map(async (version) => {
114+
// we reverse the order to put highest version first for the "branched off check"
115+
const versionData= (await Promise.all(versions.reverse().map(async (version) => {
119116
const branch = await getBranch(version);
120117
const php = await getSupportedVersions(branch);
121118
return {
122119
"phpMin": php.min,
123120
"phpMax": php.max,
124121
"branch": branch,
125122
}
126-
}));
127-
// parseFloat will ignore patch versions, leaving us with all major and minor releases
128-
const possiblePhpVersions = (await getAllPhpVersions()).map(parseFloat).filter(onlyUnique);
123+
}))).reverse();
129124

130125
// matrix with a single php version per server version
131126
const serverMatrix = cartesianProduct({
@@ -148,8 +143,11 @@ function copy(obj) {
148143
for(let version = phpMin; version <= phpMax; version += 0.1) {
149144
// floats are a pain
150145
version = parseFloat(version.toFixed(1));
151-
if (possiblePhpVersions.includes(version)) {
146+
if (await isPhpVersionReleased(version)) {
152147
php.push(version.toFixed(1));
148+
} else {
149+
// no more minors for this major
150+
version = Math.ceil(version) - 0.1;
153151
}
154152
}
155153

0 commit comments

Comments
 (0)