Refactor to use setup-php
This commit is contained in:
13
src/cache.ts
13
src/cache.ts
@@ -1,6 +1,7 @@
|
||||
import {exec} from '@actions/exec';
|
||||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import * as spu from 'setup-php/lib/utils';
|
||||
import * as path from 'path';
|
||||
import * as utils from './utils';
|
||||
|
||||
@@ -17,7 +18,7 @@ export async function handleDependencies(
|
||||
if (!/^5.[3-5]$/.test(version) && /linux|darwin/.test(process.platform)) {
|
||||
const cache_key: string = (await utils.getOutput('key')) + '-deps';
|
||||
const cache_dir: string = path.join(
|
||||
await utils.readEnv('RUNNER_TOOL_CACHE'),
|
||||
await spu.readEnv('RUNNER_TOOL_CACHE'),
|
||||
'deps'
|
||||
);
|
||||
const cache_hit: string | undefined = await cache.restoreCache(
|
||||
@@ -37,17 +38,17 @@ export async function handleDependencies(
|
||||
*/
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
const version: string = await utils.parseVersion(
|
||||
await utils.getInput('php-version', true)
|
||||
const version: string = await spu.parseVersion(
|
||||
await spu.getInput('php-version', true)
|
||||
);
|
||||
const extensions: string = await utils.filterExtensions(
|
||||
await utils.getInput('extensions', true)
|
||||
await spu.getInput('extensions', true)
|
||||
);
|
||||
const key: string = await utils.getInput('key', true);
|
||||
const key: string = await spu.getInput('key', true);
|
||||
await exec(await utils.scriptCall('data', extensions, version, key));
|
||||
await handleDependencies(extensions, version);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
core.setFailed((error as Error).message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user