Implement build, publish and run actions

This commit is contained in:
Alexey Igrychev
2020-05-28 10:31:06 +01:00
parent 95680c850e
commit b98d747c61
16 changed files with 133751 additions and 5 deletions

43
src/run.ts Normal file
View File

@@ -0,0 +1,43 @@
import * as core from '@actions/core'
import {PrepareEnvironAndRunWerfCommand} from './common'
import {String} from 'typescript-string-operations'
import { parseArgsStringToArgv } from 'string-argv'
async function run(): Promise<void> {
try {
let args = []
args.push('run')
const werfImageName = core.getInput('image')
if (werfImageName !== '') {
args.push(werfImageName)
}
// legacy
if (process.env.WERF_DOCKER_OPTIONS) {
args.push(
String.Format("--docker-options={0}", process.env.WERF_DOCKER_OPTIONS)
)
}
// legacy
if (process.env.WERF_DRY_RUN) {
args.push('--dry-run')
}
// legacy
const commandAndArgs = core.getInput('args')
if (commandAndArgs !== '') {
const parsedCommandAndArgs = parseArgsStringToArgv(commandAndArgs)
args.push('--')
args = args.concat(parsedCommandAndArgs)
}
await PrepareEnvironAndRunWerfCommand(args)
} catch (error) {
core.setFailed(error.message)
}
}
run()