mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
This commit is contained in:
parent
ef74241772
commit
e6d3daedbe
@ -1,10 +1,6 @@
|
|||||||
ARG IMAGE
|
ARG IMAGE
|
||||||
FROM $IMAGE
|
FROM $IMAGE
|
||||||
|
|
||||||
ARG UNAME=runner
|
|
||||||
ARG UID=1000
|
|
||||||
ARG GID=1000
|
|
||||||
|
|
||||||
LABEL "com.github.actions.name"="Unity - Builder"
|
LABEL "com.github.actions.name"="Unity - Builder"
|
||||||
LABEL "com.github.actions.description"="Build Unity projects for different platforms."
|
LABEL "com.github.actions.description"="Build Unity projects for different platforms."
|
||||||
LABEL "com.github.actions.icon"="box"
|
LABEL "com.github.actions.icon"="box"
|
||||||
@ -14,15 +10,9 @@ LABEL "repository"="http://github.com/webbertakken/unity-actions"
|
|||||||
LABEL "homepage"="http://github.com/webbertakken/unity-actions"
|
LABEL "homepage"="http://github.com/webbertakken/unity-actions"
|
||||||
LABEL "maintainer"="Webber Takken <webber@takken.io>"
|
LABEL "maintainer"="Webber Takken <webber@takken.io>"
|
||||||
|
|
||||||
RUN bash -c 'mkdir -p /github/{home,workflow,workspace}' && chown $UID:$GID -R /github/
|
|
||||||
RUN getent group $GID || groupadd -g $GID $UNAME
|
|
||||||
RUN id -u $UID &>/dev/null || useradd -m -u $UID -g $GID -s /bin/bash -d /github/home $UNAME
|
|
||||||
|
|
||||||
ADD default-build-script /UnityBuilderAction
|
ADD default-build-script /UnityBuilderAction
|
||||||
ADD steps /steps
|
ADD steps /steps
|
||||||
RUN chmod -R +x /steps
|
RUN chmod -R +x /steps
|
||||||
ADD entrypoint.sh /entrypoint.sh
|
ADD entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
USER $UID:$GID
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -16,13 +16,7 @@ async function action() {
|
|||||||
} else {
|
} else {
|
||||||
// Build docker image
|
// Build docker image
|
||||||
// TODO: No image required (instead use a version published to dockerhub for the action, supply credentials for github cloning)
|
// TODO: No image required (instead use a version published to dockerhub for the action, supply credentials for github cloning)
|
||||||
const builtImage = await Docker.build({
|
const builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
||||||
path: actionFolder,
|
|
||||||
dockerfile,
|
|
||||||
baseImage,
|
|
||||||
uid: buildParameters.uid,
|
|
||||||
gid: buildParameters.gid,
|
|
||||||
});
|
|
||||||
await Docker.run(builtImage, { workspace, ...buildParameters });
|
await Docker.run(builtImage, { workspace, ...buildParameters });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import os from 'os';
|
|
||||||
import AndroidVersioning from './android-versioning';
|
import AndroidVersioning from './android-versioning';
|
||||||
import Input from './input';
|
import Input from './input';
|
||||||
import Platform from './platform';
|
import Platform from './platform';
|
||||||
@ -21,13 +20,10 @@ class BuildParameters {
|
|||||||
Input.androidVersionCode,
|
Input.androidVersionCode,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { uid, gid } = os.userInfo();
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version: Input.unityVersion,
|
version: Input.unityVersion,
|
||||||
customImage: Input.customImage,
|
customImage: Input.customImage,
|
||||||
uid,
|
|
||||||
gid,
|
|
||||||
runnerTempPath: process.env.RUNNER_TEMP,
|
runnerTempPath: process.env.RUNNER_TEMP,
|
||||||
platform: Input.targetPlatform,
|
platform: Input.targetPlatform,
|
||||||
projectPath: Input.projectPath,
|
projectPath: Input.projectPath,
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
import fs from 'fs';
|
|
||||||
import { exec } from '@actions/exec';
|
import { exec } from '@actions/exec';
|
||||||
import ImageTag from './image-tag';
|
import ImageTag from './image-tag';
|
||||||
|
|
||||||
class Docker {
|
class Docker {
|
||||||
static async build(buildParameters, silent = false) {
|
static async build(buildParameters, silent = false) {
|
||||||
const { path, dockerfile, baseImage, uid, gid } = buildParameters;
|
const { path, dockerfile, baseImage } = buildParameters;
|
||||||
const { version, platform } = baseImage;
|
const { version, platform } = baseImage;
|
||||||
|
|
||||||
const tag = new ImageTag({ repository: '', name: 'unity-builder', version, platform });
|
const tag = new ImageTag({ repository: '', name: 'unity-builder', version, platform });
|
||||||
const command = `docker build ${path} \
|
const command = `docker build ${path} \
|
||||||
--file ${dockerfile} \
|
--file ${dockerfile} \
|
||||||
--build-arg IMAGE=${baseImage} \
|
--build-arg IMAGE=${baseImage} \
|
||||||
--build-arg UID=${uid} \
|
|
||||||
--build-arg GID=${gid} \
|
|
||||||
--tag ${tag}`;
|
--tag ${tag}`;
|
||||||
|
|
||||||
await exec(command, undefined, { silent });
|
await exec(command, undefined, { silent });
|
||||||
@ -86,9 +83,6 @@ class Docker {
|
|||||||
--volume "${workspace}":"/github/workspace" \
|
--volume "${workspace}":"/github/workspace" \
|
||||||
${image}`;
|
${image}`;
|
||||||
|
|
||||||
fs.mkdirSync(`${runnerTempPath}/_github_home`, { recursive: true });
|
|
||||||
fs.mkdirSync(`${runnerTempPath}/_github_workflow`, { recursive: true });
|
|
||||||
|
|
||||||
await exec(command, undefined, { silent });
|
await exec(command, undefined, { silent });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user