Make ossutil executable

This commit is contained in:
Rimo
2020-01-15 17:27:30 +08:00
parent e0feee7e7c
commit b99d85a130
4 changed files with 23 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
import * as core from '@actions/core'
import * as tc from '@actions/tool-cache'
import * as path from 'path'
import * as fs from 'fs'
const TOOL_NAME = 'ossutil'
@@ -15,7 +16,7 @@ export async function getOssutil(version: string): Promise<void> {
toolPath = await acquireOssutil(version)
}
core.info(`ossutil is cached under ${toolPath}`)
core.debug(`ossutil is cached under ${toolPath}`)
core.addPath(toolPath)
}
@@ -44,6 +45,7 @@ async function acquireOssutil(version: string): Promise<string> {
toolFile = path.join(extractFolder, 'ossutil64', 'ossutil64.exe')
core.debug(`ossutil extracted to: ${toolFile}`)
}
fs.chmodSync(toolFile, 0o755)
// cache
const fileName = process.platform === 'win32' ? 'ossutil.exe' : 'ossutil'

View File

@@ -7,6 +7,7 @@ async function run(): Promise<void> {
// download
const version = core.getInput('ossutil-version')
await installer.getOssutil(version)
core.info('ossutil is successfully installed')
// config
const endpoint = core.getInput('endpoint')
@@ -23,7 +24,10 @@ async function run(): Promise<void> {
'--sts-token',
stsToken
]
await exec.exec('ossutil', args)
const exitCode = await exec.exec('ossutil', args)
if (exitCode === 0) {
core.info('ossutil config is done')
}
} catch (error) {
core.setFailed(error.message)
}