Skip to content

Commit

Permalink
Set custom destination path when downloading archive
Browse files Browse the repository at this point in the history
Fixes #5
  • Loading branch information
CyberAndrii committed Nov 12, 2022
1 parent f1ee52d commit b786e0d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
12 changes: 10 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function getDownloadUrl()
archiveName = 'steamcmd.zip';
}

return 'https://steamcdn-a.akamaihd.net/client/installer/' + archiveName;
return ['https://steamcdn-a.akamaihd.net/client/installer/' + archiveName, archiveName];
}

function getInfo(installDir)
Expand Down Expand Up @@ -99,13 +99,21 @@ async function installLinuxDependencies()
}
}

function getTempDirectory()
{
return process.env['RUNNER_TEMP'] ?? (() => { throw new Error('Expected RUNNER_TEMP to be defined') })();
}

async function install()
{
//
// Download
//
core.info('Downloading ...');
const archivePath = await tc.downloadTool(getDownloadUrl());
const [downloadUrl, archiveName] = getDownloadUrl();

// Why we need to set the destination directory: https://github.com/CyberAndrii/setup-steamcmd/issues/5
const archivePath = await tc.downloadTool(downloadUrl, path.join(getTempDirectory(), archiveName));

//
// Extract
Expand Down

0 comments on commit b786e0d

Please sign in to comment.