switch to installing fpm via ruby via apt

This commit is contained in:
2024-01-19 13:54:45 +01:00
parent ddc730cf35
commit d95fdab11c
8 changed files with 1628 additions and 31080 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
import * as core from '@actions/core';
import * as github from '@actions/github';
import * as action_information from 'information';
import {executeFpmBuild, isTrueString, prepareFpmArgs} from './lib';
import {executeFpmBuild, installFpmViaRuby, isTrueString, prepareFpmArgs} from './lib';
try {
@@ -14,6 +14,8 @@ try {
const fpmArgs = prepareFpmArgs();
await installFpmViaRuby();
executeFpmBuild(fpmArgs, debug);
}
catch (error) {
+17 -20
View File
@@ -1,37 +1,34 @@
import * as core from '@actions/core';
import child_process from 'child_process';
const exec = require('@actions/exec');
export function prepareFpmArgs() {
return '';
}
export function executeFpmBuild(computedFpmArgs, debug) {
export async function installFpmViaRuby(debug) {
const aptCmd = 'sudo apt-get install 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 dockerCmd = 'docker run --rm -i'
+ ` -v "${process.cwd()}:/workspace/source"`
+ ' -w /workspace/source'
+ ' gitea.dhswt.de/actions/fpm:master'
const fpmCmd = 'fpm'
+ ' ' + computedFpmArgs
+ ' ' + userFpmArgs;
if (debug) {
console.log('docker command: ', dockerCmd);
console.log('fpm command: ', fpmCmd);
}
const proc = child_process.spawnSync(dockerCmd, {
shell: true,
stdio: 'inherit',
cwd : process.cwd()
});
if (proc.status != null && proc.status > 0) {
throw new Error('fpm build failed');
}
if (proc.error != null) {
throw proc.error;
}
await exec.exec(fpmCmd);
}
function isNonEmptyStr(str) {