Compare commits

...

8 Commits

8 changed files with 1948 additions and 622 deletions

View File

@ -1,27 +0,0 @@
name: Docker Build
on: push
env:
ACTIONS_STEP_DEBUG: "true"
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: https://gitea.dhswt.de/actions/docker-fix-socket-perm@master
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: https://gitea.dhswt.de/actions/docker@master
with:
ci_registry_password: ${{ secrets.RELEASE_TOKEN }}
docker_multiarch: false # re-enable after development is done
docker_context_dir: image/

2465
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
FROM debian:bookworm
RUN apt-get update \
&& apt-get install -y \
ruby \
build-essential \
rpm \
tar \
zip \
&& gem install --no-document fpm -v 1.15.1
ADD --chmod=755 entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -1,5 +0,0 @@
#!/usr/bin/env sh
set -e
exec fpm "$@"

14
package-lock.json generated
View File

@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"information": "file:../information",
"js-base64": "^3.7.5"
@ -7339,6 +7340,14 @@
"uuid": "^8.3.2"
}
},
"node_modules/@actions/exec": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==",
"dependencies": {
"@actions/io": "^1.0.1"
}
},
"node_modules/@actions/github": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz",
@ -7359,6 +7368,11 @@
"undici": "^5.25.4"
}
},
"node_modules/@actions/io": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz",
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
},
"node_modules/@ampproject/remapping": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz",

View File

@ -18,6 +18,7 @@
"license": "ISC",
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"information": "file:../information",
"js-base64": "^3.7.5"

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) {

View File

@ -1,37 +1,37 @@
import * as core from '@actions/core';
import child_process from 'child_process';
import fs from 'fs';
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 -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 dockerCmd = 'docker run --rm -i'
+ ` -v "${process.cwd()}:/workspace/source"`
+ ' -w /workspace/source'
+ ' gitea.dhswt.de/actions/fpm:master'
const fpmCmd = 'fpm'
+ ' ' + computedFpmArgs
+ ' ' + userFpmArgs;
fs.writeFileSync("/tmp/action-fpm-command-bash", fpmCmd);
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("bash /tmp/action-fpm-command-bash");
}
function isNonEmptyStr(str) {