semver and channel for cache dir

This commit is contained in:
Alif Rachmawadi
2019-08-14 08:04:15 +07:00
parent aedc3a9f1e
commit 048d11febc
3 changed files with 17 additions and 6 deletions

View File

@@ -32,7 +32,10 @@ export async function getFlutter(
version: string,
channel: string
): Promise<void> {
let toolPath = tc.find('Flutter', version);
// make semver compatible, eg: 1.7.8+hotfix.4 -> 1.7.8-hotfix.4
const semver = version.replace('+', '-');
const cleanver = `${semver}-${channel}`;
let toolPath = tc.find('Flutter', cleanver);
if (toolPath) {
core.debug(`Tool found in cache ${toolPath}`);
@@ -46,7 +49,7 @@ export async function getFlutter(
const sdkDir = await extractDownload(sdkFile, tempDir);
core.debug(`Flutter sdk extracted to ${sdkDir}`);
toolPath = await tc.cacheDir(sdkDir, 'Flutter', version);
toolPath = await tc.cacheDir(sdkDir, 'Flutter', cleanver);
}
core.exportVariable('FLUTTER_HOME', toolPath);