* Downloads go-sqlcmd release from GitHub and extracts from the compressed file. * @returns The path to the extracted file.
()
| 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 | } |