fix for mac
This commit is contained in:
35
dist/index.js
generated
vendored
35
dist/index.js
generated
vendored
@@ -32830,10 +32830,10 @@ exports.installOssutil = installOssutil;
|
|||||||
*/
|
*/
|
||||||
async function downloadOssutil(version) {
|
async function downloadOssutil(version) {
|
||||||
// download
|
// download
|
||||||
const downloadFileName = getDownloadFileName(version);
|
const zipFileName = getZipFileName(version);
|
||||||
let downloadedFile;
|
let downloadedFile;
|
||||||
try {
|
try {
|
||||||
const downloadUrl = `${DownloadEndpoint}/${version}/${downloadFileName}.zip`;
|
const downloadUrl = `${DownloadEndpoint}/${version}/${zipFileName}.zip`;
|
||||||
core.info(`Downloading ossutil from: ${downloadUrl}`);
|
core.info(`Downloading ossutil from: ${downloadUrl}`);
|
||||||
downloadedFile = await tc.downloadTool(downloadUrl);
|
downloadedFile = await tc.downloadTool(downloadUrl);
|
||||||
}
|
}
|
||||||
@@ -32846,8 +32846,8 @@ async function downloadOssutil(version) {
|
|||||||
const zipFile = `${downloadedFile}.zip`;
|
const zipFile = `${downloadedFile}.zip`;
|
||||||
await io.mv(downloadedFile, zipFile);
|
await io.mv(downloadedFile, zipFile);
|
||||||
const extractFolder = await tc.extractZip(zipFile);
|
const extractFolder = await tc.extractZip(zipFile);
|
||||||
const toolFileName = IS_WINDOWS ? 'ossutil64.exe' : 'ossutil64';
|
const toolFileName = getToolFileName();
|
||||||
const toolFile = path.join(extractFolder, downloadFileName, toolFileName);
|
const toolFile = path.join(extractFolder, zipFileName, toolFileName);
|
||||||
if (fs.existsSync(toolFile)) {
|
if (fs.existsSync(toolFile)) {
|
||||||
core.info(`ossutil extracted to: ${toolFile}`);
|
core.info(`ossutil extracted to: ${toolFile}`);
|
||||||
}
|
}
|
||||||
@@ -32863,11 +32863,11 @@ async function downloadOssutil(version) {
|
|||||||
return toolPath;
|
return toolPath;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get the file name of the specific version of ossutil
|
* Get the zip file name of the specific version of ossutil
|
||||||
* @param version the version of ossutil to download
|
* @param version the version of ossutil to download
|
||||||
* @returns the file name (e.g., ossutil-v1.7.19-linux-amd64)
|
* @returns the zip file name (e.g., ossutil-v1.7.19-linux-amd64)
|
||||||
*/
|
*/
|
||||||
function getDownloadFileName(version) {
|
function getZipFileName(version) {
|
||||||
let platform = '';
|
let platform = '';
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
@@ -32895,6 +32895,27 @@ function getDownloadFileName(version) {
|
|||||||
}
|
}
|
||||||
return `ossutil-v${version}-${platform}-${arch}`;
|
return `ossutil-v${version}-${platform}-${arch}`;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the file name of ossutil
|
||||||
|
* @returns the file name (e.g., ossutil64)
|
||||||
|
*/
|
||||||
|
function getToolFileName() {
|
||||||
|
let filename = 'ossutil';
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'linux':
|
||||||
|
filename += '64';
|
||||||
|
break;
|
||||||
|
case 'win32':
|
||||||
|
filename += '64.exe';
|
||||||
|
break;
|
||||||
|
case 'darwin':
|
||||||
|
filename += 'mac64';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported platform ${process.platform}`);
|
||||||
|
}
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Get the latest version of ossutil
|
* Get the latest version of ossutil
|
||||||
* @returns the latest version
|
* @returns the latest version
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ export async function installOssutil(version: string): Promise<void> {
|
|||||||
*/
|
*/
|
||||||
async function downloadOssutil(version: string): Promise<string> {
|
async function downloadOssutil(version: string): Promise<string> {
|
||||||
// download
|
// download
|
||||||
const downloadFileName = getDownloadFileName(version)
|
const zipFileName = getZipFileName(version)
|
||||||
let downloadedFile: string
|
let downloadedFile: string
|
||||||
try {
|
try {
|
||||||
const downloadUrl = `${DownloadEndpoint}/${version}/${downloadFileName}.zip`
|
const downloadUrl = `${DownloadEndpoint}/${version}/${zipFileName}.zip`
|
||||||
core.info(`Downloading ossutil from: ${downloadUrl}`)
|
core.info(`Downloading ossutil from: ${downloadUrl}`)
|
||||||
downloadedFile = await tc.downloadTool(downloadUrl)
|
downloadedFile = await tc.downloadTool(downloadUrl)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -50,8 +50,8 @@ async function downloadOssutil(version: string): Promise<string> {
|
|||||||
const zipFile = `${downloadedFile}.zip`
|
const zipFile = `${downloadedFile}.zip`
|
||||||
await io.mv(downloadedFile, zipFile)
|
await io.mv(downloadedFile, zipFile)
|
||||||
const extractFolder = await tc.extractZip(zipFile)
|
const extractFolder = await tc.extractZip(zipFile)
|
||||||
const toolFileName = IS_WINDOWS ? 'ossutil64.exe' : 'ossutil64'
|
const toolFileName = getToolFileName()
|
||||||
const toolFile = path.join(extractFolder, downloadFileName, toolFileName)
|
const toolFile = path.join(extractFolder, zipFileName, toolFileName)
|
||||||
if (fs.existsSync(toolFile)) {
|
if (fs.existsSync(toolFile)) {
|
||||||
core.info(`ossutil extracted to: ${toolFile}`)
|
core.info(`ossutil extracted to: ${toolFile}`)
|
||||||
} else {
|
} else {
|
||||||
@@ -74,11 +74,11 @@ async function downloadOssutil(version: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the file name of the specific version of ossutil
|
* Get the zip file name of the specific version of ossutil
|
||||||
* @param version the version of ossutil to download
|
* @param version the version of ossutil to download
|
||||||
* @returns the file name (e.g., ossutil-v1.7.19-linux-amd64)
|
* @returns the zip file name (e.g., ossutil-v1.7.19-linux-amd64)
|
||||||
*/
|
*/
|
||||||
function getDownloadFileName(version: string): string {
|
function getZipFileName(version: string): string {
|
||||||
let platform = ''
|
let platform = ''
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
@@ -109,6 +109,29 @@ function getDownloadFileName(version: string): string {
|
|||||||
return `ossutil-v${version}-${platform}-${arch}`
|
return `ossutil-v${version}-${platform}-${arch}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the file name of ossutil
|
||||||
|
* @returns the file name (e.g., ossutil64)
|
||||||
|
*/
|
||||||
|
function getToolFileName(): string {
|
||||||
|
let filename = 'ossutil'
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'linux':
|
||||||
|
filename += '64'
|
||||||
|
break
|
||||||
|
case 'win32':
|
||||||
|
filename += '64.exe'
|
||||||
|
break
|
||||||
|
case 'darwin':
|
||||||
|
filename += 'mac64'
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
throw new Error(`Unsupported platform ${process.platform}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return filename
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the latest version of ossutil
|
* Get the latest version of ossutil
|
||||||
* @returns the latest version
|
* @returns the latest version
|
||||||
|
|||||||
Reference in New Issue
Block a user