Use fs-extra.moveSync instead of fs.renameSync to move cmdline-tools

fs.renameSync can't rename across drives.
This commit is contained in:
Vilius Sutkus '89 2021-02-03 03:41:47 +02:00 committed by Dave Olsthoorn
parent 6bde8445cd
commit 999dabf39c
3 changed files with 48 additions and 5 deletions

42
package-lock.json generated
View file

@ -2276,6 +2276,11 @@
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" "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": { "atob": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
@ -3932,6 +3937,24 @@
"map-cache": "^0.2.2" "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": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -4051,8 +4074,7 @@
"graceful-fs": { "graceful-fs": {
"version": "4.2.4", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
"integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw=="
"dev": true
}, },
"growly": { "growly": {
"version": "1.3.0", "version": "1.3.0",
@ -7158,6 +7180,22 @@
"minimist": "^1.2.0" "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": { "jsprim": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",

View file

@ -27,7 +27,8 @@
"dependencies": { "dependencies": {
"@actions/cache": "^1.0.6", "@actions/cache": "^1.0.6",
"@actions/core": "^1.2.6", "@actions/core": "^1.2.6",
"@actions/tool-cache": "^1.6.1" "@actions/tool-cache": "^1.6.1",
"fs-extra": "^9.1.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^26.0.20", "@types/jest": "^26.0.20",

View file

@ -3,6 +3,7 @@ import * as tc from '@actions/tool-cache'
import * as exec from '@actions/exec' import * as exec from '@actions/exec'
import * as path from 'path' import * as path from 'path'
import * as fs from 'fs' import * as fs from 'fs'
import * as fse from 'fs-extra'
import * as os from 'os' import * as os from 'os'
const CMDLINE_TOOLS_VERSION = '3.0' const CMDLINE_TOOLS_VERSION = '3.0'
@ -114,8 +115,11 @@ async function installSdkManager(): Promise<string> {
'cmdline-tools', 'cmdline-tools',
CMDLINE_TOOLS_VERSION 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'), path.join(cmdlineToolsExtractedLocation, 'cmdline-tools'),
desiredLocation desiredLocation
) )