Skip to content

Commit

Permalink
WRS-5893 - GitHub action: Gitea runner
Browse files Browse the repository at this point in the history
  • Loading branch information
siarb committed Feb 10, 2025
1 parent f8b06eb commit 698607b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ inputs:
pdf:
description: "Generate PDF as artifact"
required: false
workingDirectory:
description: "The directory inside the Writerside container where source files and artifacts will be processed"
required: false
container:
description: "The name of an existing container whose volumes will be mounted for use in the current process"
required: false

runs:
using: 'node20'
Expand Down
2 changes: 2 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27844,6 +27844,8 @@ async function run() {
const artifact = core.getInput('artifact');
const pdf = core.getInput('pdf');
const workspace = process.env.GITHUB_WORKSPACE;
const container = core.getInput('container') || '';
const workingDirectory = core.getInput('workingDirectory') || '/github/workspace';

// Set a default docker image if docker-version is undefined
if (!imageVersion) {
Expand Down
30 changes: 19 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ async function run() {
const artifact = core.getInput('artifact');
const pdf = core.getInput('pdf');
const workspace = process.env.GITHUB_WORKSPACE;
const container = core.getInput('container') || '';
const workingDirectory = core.getInput('workingDirectory') || '/github/workspace';

// Set a default docker image if docker-version is undefined
if (!imageVersion) {
Expand All @@ -24,29 +26,35 @@ async function run() {
const commands = `
export DISPLAY=:99
Xvfb :99 &
git config --global --add safe.directory /github/workspace
/opt/builder/bin/idea.sh helpbuilderinspect -source-dir /github/workspace/${location} -product ${instance} --runner github -output-dir /github/workspace/artifacts/ ${pdfFlag} || true
git config --global --add safe.directory ${workingDirectory}
/opt/builder/bin/idea.sh helpbuilderinspect -source-dir ${workingDirectory}/${location} -product ${instance} --runner github -output-dir ${workingDirectory}/artifacts/ || true
echo "Test existing artifacts"
test -e /github/workspace/artifacts/${artifact} && echo ${artifact} exists
if [ -z "$(ls -A /github/workspace/artifacts/ 2>/dev/null)" ]; then
test -e ${workingDirectory}/artifacts/${artifact} && echo ${artifact} exists
if [ -z "$(ls -A ${workingDirectory}/artifacts/ 2>/dev/null)" ]; then
echo "Artifacts not found" && false
else
chmod 777 /github/workspace/artifacts/
ls -la /github/workspace/artifacts/
chmod 777 ${workingDirectory}/artifacts/
ls -la ${workingDirectory}/artifacts/
fi
`;

// Run your Docker container
await exec.exec('docker', [
const args = [
'run',
'--rm',
'-v',
`${workspace}:/github/workspace`,
]
if (container !== '') {
args.push("--volumes-from", container);
} else {
args.push("-v", `${workspace}:${workingDirectory}`);
}
args.push(
`registry.jetbrains.team/p/writerside/builder/writerside-builder:${imageVersion}`,
'/bin/bash',
'-c',
commands
]);
)
// Run your Docker container
await exec.exec('docker', args);
}
catch (error) {
core.setFailed(error.message);
Expand Down

0 comments on commit 698607b

Please sign in to comment.