Compare commits

..

No commits in common. "install-fpm" and "master" have entirely different histories.

8 changed files with 622 additions and 1948 deletions

View File

@ -0,0 +1,27 @@
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

14
image/Dockerfile Normal file
View File

@ -0,0 +1,14 @@
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"]

5
image/entrypoint.sh Normal file
View File

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

14
package-lock.json generated
View File

@ -10,7 +10,6 @@
"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"
@ -7340,14 +7339,6 @@
"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",
@ -7368,11 +7359,6 @@
"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,7 +18,6 @@
"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, installFpmViaRuby, isTrueString, prepareFpmArgs} from './lib';
import {executeFpmBuild, isTrueString, prepareFpmArgs} from './lib';
try {
@ -14,8 +14,6 @@ try {
const fpmArgs = prepareFpmArgs();
await installFpmViaRuby();
executeFpmBuild(fpmArgs, debug);
}
catch (error) {

View File

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