fix: only change file extension of we are on Windows

This commit is contained in:
Jonathan Camara 2022-04-27 16:32:54 -05:00
parent 62f144899a
commit 07c30f59da
No known key found for this signature in database
GPG key ID: E87744B8CC664ACD
2 changed files with 22 additions and 10 deletions

16
dist/index.js vendored
View file

@ -38,13 +38,19 @@ async function downloadCLI (url) {
core.debug(`Downloading Terraform CLI from ${url}`);
const pathToCLIZip = await tc.downloadTool(url);
core.debug(`Terraform CLI Download Path is ${pathToCLIZip}`)
fixedPathToCLIZip=`${pathToCLIZip}.zip`
io.mv(pathToCLIZip,fixedPathToCLIZip)
core.debug(`Moved download to ${fixedPathToCLIZip}`)
const pathToCLI = "";
if (os.platform().startsWith('win')) {
core.debug(`Terraform CLI Download Path is ${pathToCLIZip}`)
fixedPathToCLIZip = `${pathToCLIZip}.zip`
io.mv(pathToCLIZip, fixedPathToCLIZip)
core.debug(`Moved download to ${fixedPathToCLIZip}`)
pathToCLI = await tc.extractZip(fixedPathToCLIZip);
} else {
pathToCLI = await tc.extractZip(pathToCLIZip);
}
core.debug('Extracting Terraform CLI zip file');
const pathToCLI = await tc.extractZip(fixedPathToCLIZip);
core.debug(`Terraform CLI path is ${pathToCLI}.`);
if (!pathToCLIZip || !pathToCLI) {

View file

@ -32,13 +32,19 @@ async function downloadCLI (url) {
core.debug(`Downloading Terraform CLI from ${url}`);
const pathToCLIZip = await tc.downloadTool(url);
core.debug(`Terraform CLI Download Path is ${pathToCLIZip}`)
fixedPathToCLIZip=`${pathToCLIZip}.zip`
io.mv(pathToCLIZip,fixedPathToCLIZip)
core.debug(`Moved download to ${fixedPathToCLIZip}`)
const pathToCLI = "";
if (os.platform().startsWith('win')) {
core.debug(`Terraform CLI Download Path is ${pathToCLIZip}`)
fixedPathToCLIZip = `${pathToCLIZip}.zip`
io.mv(pathToCLIZip, fixedPathToCLIZip)
core.debug(`Moved download to ${fixedPathToCLIZip}`)
pathToCLI = await tc.extractZip(fixedPathToCLIZip);
} else {
pathToCLI = await tc.extractZip(pathToCLIZip);
}
core.debug('Extracting Terraform CLI zip file');
const pathToCLI = await tc.extractZip(fixedPathToCLIZip);
core.debug(`Terraform CLI path is ${pathToCLI}.`);
if (!pathToCLIZip || !pathToCLI) {