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

@@ -46,7 +46,10 @@ if (!tempDirectory) {
}
function getFlutter(version, channel) {
return __awaiter(this, void 0, void 0, function* () {
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}`);
}
@@ -57,7 +60,7 @@ function getFlutter(version, channel) {
let tempDir = generateTempDir();
const sdkDir = yield extractDownload(sdkFile, tempDir);
core.debug(`Flutter sdk extracted to ${sdkDir}`);
toolPath = yield tc.cacheDir(sdkDir, 'Flutter', version);
toolPath = yield tc.cacheDir(sdkDir, 'Flutter', cleanver);
}
core.exportVariable('FLUTTER_HOME', toolPath);
core.addPath(path.join(toolPath, 'bin'));