Add support for nightly alias

This commit is contained in:
Shivam Mathur 2021-09-06 11:58:31 +05:30
parent 8eebeae48a
commit d068c17d9e
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 4 additions and 2 deletions

View File

@ -371,6 +371,7 @@ Disable coverage for these reasons:
- Specify the PHP version you want to set up. - Specify the PHP version you want to set up.
- Accepts a `string`. For example `'8.0'`. - Accepts a `string`. For example `'8.0'`.
- Accepts `latest` to set up the latest stable PHP version. - Accepts `latest` to set up the latest stable PHP version.
- Accepts `nightly` to set up a nightly build from the master branch of PHP.
- Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`. - Accepts the format `d.x`, where `d` is the major version. For example `5.x`, `7.x` and `8.x`.
- See [PHP support](#tada-php-support) for supported PHP versions. - See [PHP support](#tada-php-support) for supported PHP versions.

2
dist/index.js vendored
View File

@ -965,7 +965,7 @@ exports.getManifestURL = getManifestURL;
async function parseVersion(version) { async function parseVersion(version) {
const manifest = await getManifestURL(); const manifest = await getManifestURL();
switch (true) { switch (true) {
case /^(latest|\d+\.x)$/.test(version): case /^(latest|nightly|\d+\.x)$/.test(version):
return JSON.parse((await fetch(manifest))['data'])[version]; return JSON.parse((await fetch(manifest))['data'])[version];
default: default:
switch (true) { switch (true) {

View File

@ -1,5 +1,6 @@
{ {
"latest": "8.0", "latest": "8.0",
"nightly": "8.2",
"5.x": "5.6", "5.x": "5.6",
"7.x": "7.4", "7.x": "7.4",
"8.x": "8.0" "8.x": "8.0"

View File

@ -102,7 +102,7 @@ export async function getManifestURL(): Promise<string> {
export async function parseVersion(version: string): Promise<string> { export async function parseVersion(version: string): Promise<string> {
const manifest = await getManifestURL(); const manifest = await getManifestURL();
switch (true) { switch (true) {
case /^(latest|\d+\.x)$/.test(version): case /^(latest|nightly|\d+\.x)$/.test(version):
return JSON.parse((await fetch(manifest))['data'])[version]; return JSON.parse((await fetch(manifest))['data'])[version];
default: default:
switch (true) { switch (true) {