47 lines
1016 B
JavaScript
47 lines
1016 B
JavaScript
import * as core from '@actions/core';
|
|
import fs from 'fs';
|
|
|
|
const exec = require('@actions/exec');
|
|
|
|
export function prepareFpmArgs() {
|
|
return '';
|
|
}
|
|
|
|
export async function installFpmViaRuby(debug) {
|
|
const aptCmd = 'sudo apt-get install -y ruby';
|
|
const gemCmd = 'sudo gem install fpm';
|
|
if (debug) {
|
|
console.log('ruby install command: ', rubyCmd);
|
|
}
|
|
|
|
await exec.exec(aptCmd);
|
|
await exec.exec(gemCmd);
|
|
}
|
|
|
|
export async function executeFpmBuild(computedFpmArgs, debug) {
|
|
|
|
const userFpmArgs = core.getInput('fpm_args');
|
|
const fpmCmd = 'fpm'
|
|
+ ' ' + computedFpmArgs
|
|
+ ' ' + userFpmArgs;
|
|
|
|
fs.writeFileSync("/tmp/action-fpm-command-bash", fpmCmd);
|
|
|
|
if (debug) {
|
|
console.log('fpm command: ', fpmCmd);
|
|
}
|
|
|
|
await exec.exec("bash /tmp/action-fpm-command-bash");
|
|
}
|
|
|
|
function isNonEmptyStr(str) {
|
|
return str != null && str !== 'false' && str.length > 0;
|
|
}
|
|
|
|
export function isTrueString(str) {
|
|
return str === '1'
|
|
|| str === 'true'
|
|
|| str === 'True'
|
|
|| str === 'TRUE';
|
|
}
|