support older style php version check

This commit is contained in:
Robin Appelman 2024-07-18 18:36:19 +02:00
commit ddbeff6b7a
5 changed files with 26 additions and 9 deletions

View file

@ -82,5 +82,10 @@ Maximum supported server version, as a single-item list
Minimum supported server version, as a single-item list Minimum supported server version, as a single-item list
## Building
- `npm ci`
- `./node_modules/.bin/ncc build src/action.js -o dist`
## License ## License
[MIT License](LICENSE.md) [MIT License](LICENSE.md)

10
dist/index.js vendored
View file

@ -42544,8 +42544,14 @@ async function getSupportedVersions(branch) {
// yes, this is hacky, but it saves having to keep a list updated // yes, this is hacky, but it saves having to keep a list updated
let res = await client.get(`https://raw.githubusercontent.com/nextcloud/server/${branch}/lib/versioncheck.php`); let res = await client.get(`https://raw.githubusercontent.com/nextcloud/server/${branch}/lib/versioncheck.php`);
let versionCheckCode = await res.readBody(); let versionCheckCode = await res.readBody();
let min = parseVersionId(versionCheckCode.match(/PHP_VERSION_ID < (\d+)/)[1]); let min, max;
let max = parseVersionId(versionCheckCode.match(/PHP_VERSION_ID >= (\d+)/)[1]); if (versionCheckCode.match(/PHP_VERSION_ID < (\d+)/)) {
min = parseVersionId(versionCheckCode.match(/PHP_VERSION_ID < (\d+)/)[1]);
max = parseVersionId(versionCheckCode.match(/PHP_VERSION_ID >= (\d+)/)[1]);
} else {
min = parseFloat(versionCheckCode.match(/PHP_VERSION, '([\d.]+)'\) === -1/)[1]);
max = parseFloat(versionCheckCode.match(/PHP_VERSION, '([\d.]+)'\) !== -1/)[1]);
}
max = parseFloat((max - 0.1).toFixed(1)); max = parseFloat((max - 0.1).toFixed(1));
return {min: min, max: max}; return {min: min, max: max};
} }

8
flake.lock generated
View file

@ -2,16 +2,16 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1698936415, "lastModified": 1721316023,
"narHash": "sha256-RnAVJaiy8utQ6GQIRvStfyHIN95gTp7DVKXbmn9KhWc=", "narHash": "sha256-mvz1IUj3Eh3U7AByQmHU5noEpUbxpMc3qwQ6VJMWaMQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "40c37a9735652cbac03bbef30a1bad7f9edf0e92", "rev": "5d0ced7b8a29f62acd51db3c2a09ce73e3c1d9c3",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "release-23.05", "ref": "release-24.05",
"type": "indirect" "type": "indirect"
} }
}, },

View file

@ -1,7 +1,7 @@
{ {
inputs = { inputs = {
utils.url = "github:numtide/flake-utils"; utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/release-23.05"; nixpkgs.url = "nixpkgs/release-24.05";
}; };
outputs = { outputs = {

View file

@ -30,8 +30,14 @@ async function getSupportedVersions(branch) {
// yes, this is hacky, but it saves having to keep a list updated // yes, this is hacky, but it saves having to keep a list updated
let res = await client.get(`https://raw.githubusercontent.com/nextcloud/server/${branch}/lib/versioncheck.php`); let res = await client.get(`https://raw.githubusercontent.com/nextcloud/server/${branch}/lib/versioncheck.php`);
let versionCheckCode = await res.readBody(); let versionCheckCode = await res.readBody();
let min = parseVersionId(versionCheckCode.match(/PHP_VERSION_ID < (\d+)/)[1]); let min, max;
let max = parseVersionId(versionCheckCode.match(/PHP_VERSION_ID >= (\d+)/)[1]); if (versionCheckCode.match(/PHP_VERSION_ID < (\d+)/)) {
min = parseVersionId(versionCheckCode.match(/PHP_VERSION_ID < (\d+)/)[1]);
max = parseVersionId(versionCheckCode.match(/PHP_VERSION_ID >= (\d+)/)[1]);
} else {
min = parseFloat(versionCheckCode.match(/PHP_VERSION, '([\d.]+)'\) === -1/)[1]);
max = parseFloat(versionCheckCode.match(/PHP_VERSION, '([\d.]+)'\) !== -1/)[1]);
}
max = parseFloat((max - 0.1).toFixed(1)); max = parseFloat((max - 0.1).toFixed(1));
return {min: min, max: max}; return {min: min, max: max};
} }