Fix manifest URL for v1

This commit is contained in:
Shivam Mathur 2022-02-07 13:10:17 +05:30
parent f4e1b8d33e
commit 61aa0dc2f9
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
3 changed files with 5 additions and 5 deletions

View File

@ -9,7 +9,7 @@ jest.mock('@actions/core', () => ({
})); }));
jest.spyOn(utils, 'fetch').mockImplementation(async (url): Promise<string> => { jest.spyOn(utils, 'fetch').mockImplementation(async (url): Promise<string> => {
return `{ "latest": "8.1", "5.x": "5.6", "url": "${url}" }`; return `{ "latest": "8.0", "5.x": "5.6", "url": "${url}" }`;
}); });
async function cleanup(path: string): Promise<void> { async function cleanup(path: string): Promise<void> {
@ -42,12 +42,12 @@ describe('Utils tests', () => {
it('checking fetch', async () => { it('checking fetch', async () => {
expect(await utils.fetch('test_url')).toBe( expect(await utils.fetch('test_url')).toBe(
'{ "latest": "8.1", "5.x": "5.6", "url": "test_url" }' '{ "latest": "8.0", "5.x": "5.6", "url": "test_url" }'
); );
}); });
it('checking parseVersion', async () => { it('checking parseVersion', async () => {
expect(await utils.parseVersion('latest')).toBe('8.1'); expect(await utils.parseVersion('latest')).toBe('8.0');
expect(await utils.parseVersion('7')).toBe('7.0'); expect(await utils.parseVersion('7')).toBe('7.0');
expect(await utils.parseVersion('7.4')).toBe('7.4'); expect(await utils.parseVersion('7.4')).toBe('7.4');
expect(await utils.parseVersion('5.x')).toBe('5.6'); expect(await utils.parseVersion('5.x')).toBe('5.6');

2
dist/index.js vendored
View File

@ -869,7 +869,7 @@ async function fetch(url) {
} }
exports.fetch = fetch; exports.fetch = fetch;
async function parseVersion(version) { async function parseVersion(version) {
const manifest = 'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json'; const manifest = 'https://raw.githubusercontent.com/shivammathur/setup-php/releases/v1/src/configs/php-versions.json';
switch (true) { switch (true) {
case /^(latest|\d+\.x)$/.test(version): case /^(latest|\d+\.x)$/.test(version):
return JSON.parse(await fetch(manifest))[version]; return JSON.parse(await fetch(manifest))[version];

View File

@ -71,7 +71,7 @@ export async function fetch(url: string): Promise<string> {
*/ */
export async function parseVersion(version: string): Promise<string> { export async function parseVersion(version: string): Promise<string> {
const manifest = const manifest =
'https://raw.githubusercontent.com/shivammathur/setup-php/develop/src/configs/php-versions.json'; 'https://raw.githubusercontent.com/shivammathur/setup-php/releases/v1/src/configs/php-versions.json';
switch (true) { switch (true) {
case /^(latest|\d+\.x)$/.test(version): case /^(latest|\d+\.x)$/.test(version):
return JSON.parse(await fetch(manifest))[version]; return JSON.parse(await fetch(manifest))[version];