diff --git a/package-lock.json b/package-lock.json index 7dcb097..a6faaac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2276,6 +2276,11 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, + "at-least-node": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", + "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" + }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -3932,6 +3937,24 @@ "map-cache": "^0.2.2" } }, + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "dependencies": { + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + } + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -4051,8 +4074,7 @@ "graceful-fs": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", - "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", - "dev": true + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" }, "growly": { "version": "1.3.0", @@ -7158,6 +7180,22 @@ "minimist": "^1.2.0" } }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + }, + "dependencies": { + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + } + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", diff --git a/package.json b/package.json index afd415a..4f05d4d 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "dependencies": { "@actions/cache": "^1.0.6", "@actions/core": "^1.2.6", - "@actions/tool-cache": "^1.6.1" + "@actions/tool-cache": "^1.6.1", + "fs-extra": "^9.1.0" }, "devDependencies": { "@types/jest": "^26.0.20", diff --git a/src/main.ts b/src/main.ts index c153f2d..ab3bc59 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,6 +3,7 @@ import * as tc from '@actions/tool-cache' import * as exec from '@actions/exec' import * as path from 'path' import * as fs from 'fs' +import * as fse from 'fs-extra' import * as os from 'os' const CMDLINE_TOOLS_VERSION = '3.0' @@ -114,8 +115,11 @@ async function installSdkManager(): Promise { 'cmdline-tools', CMDLINE_TOOLS_VERSION ) - fs.mkdirSync(path.dirname(desiredLocation)) - fs.renameSync( + + fs.mkdirSync(path.dirname(desiredLocation), {recursive: true}) + // @TODO: use io.mv instead of fs-extra once following issue is resolved: + // https://github.com/actions/toolkit/issues/706 + fse.moveSync( path.join(cmdlineToolsExtractedLocation, 'cmdline-tools'), desiredLocation )