MCPcopy Create free account
hub / github.com/Azure/sql-action / downloadAndExtractSqlcmd

Method downloadAndExtractSqlcmd

src/Setup.ts:33–50  ·  view source on GitHub ↗

* Downloads go-sqlcmd release from GitHub and extracts from the compressed file. * @returns The path to the extracted file.

()

Source from the content-addressed store, hash-verified

31 * @returns The path to the extracted file.
32 */
33 private static async downloadAndExtractSqlcmd(): Promise<string> {
34 let downloadPath: string;
35 switch (process.platform) {
36 case 'linux':
37 downloadPath = await tc.downloadTool(`https://github.com/microsoft/go-sqlcmd/releases/download/v${sqlcmdVersion}/sqlcmd-v${sqlcmdVersion}-linux-x64.tar.bz2`);
38 return await tc.extractTar(downloadPath, undefined, 'xj');
39
40 case 'win32':
41 // forcing a .zip extension on the downloaded item due to inconsistent windows behavior in unzipping files with no extension
42 // upstream issue: https://github.com/actions/toolkit/issues/1179
43 const dest = path.join(process.env['RUNNER_TEMP'] || '', uuidV4()+'.zip');
44 downloadPath = await tc.downloadTool(`https://github.com/microsoft/go-sqlcmd/releases/download/v${sqlcmdVersion}/sqlcmd-v${sqlcmdVersion}-windows-x64.zip`, dest);
45 return await tc.extractZip(downloadPath);
46
47 default:
48 throw new Error(`Runner OS is not supported: ${process.platform}`);
49 }
50 }
51}

Callers 1

setupSqlcmdMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected