Fixes files owned by root
parent
7e7938581c
commit
0ca8806349
|
|
@ -1,6 +1,10 @@
|
||||||
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"
|
||||||
|
|
@ -10,6 +14,12 @@ 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
|
||||||
|
|
||||||
|
RUN chown $UID:$GID -R /opt/unity/
|
||||||
|
|
||||||
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
|
||||||
|
|
@ -18,3 +28,5 @@ RUN chmod +x /entrypoint.sh
|
||||||
RUN ls
|
RUN ls
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
|
USER $UID:$GID
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "Exporting HOME as /github/home"
|
||||||
|
export HOME=/github/home
|
||||||
|
|
||||||
if [[ -n "$UNITY_LICENSE" ]] || [[ -n "$UNITY_LICENSE_FILE" ]]; then
|
if [[ -n "$UNITY_LICENSE" ]] || [[ -n "$UNITY_LICENSE_FILE" ]]; then
|
||||||
#
|
#
|
||||||
# PERSONAL LICENSE MODE
|
# PERSONAL LICENSE MODE
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,13 @@ async function run() {
|
||||||
// default and local case
|
// default and local case
|
||||||
default:
|
default:
|
||||||
core.info('Building locally');
|
core.info('Building locally');
|
||||||
builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
builtImage = await Docker.build({
|
||||||
|
path: actionFolder,
|
||||||
|
dockerfile,
|
||||||
|
baseImage,
|
||||||
|
uid: buildParameters.uid,
|
||||||
|
gid: buildParameters.gid,
|
||||||
|
});
|
||||||
await Docker.run(builtImage, { workspace, ...buildParameters });
|
await Docker.run(builtImage, { workspace, ...buildParameters });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
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';
|
||||||
|
|
@ -14,10 +15,13 @@ class BuildParameters {
|
||||||
|
|
||||||
const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode);
|
const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode);
|
||||||
|
|
||||||
|
const { uid, gid } = os.userInfo();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version: unityVersion,
|
version: 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,15 +1,18 @@
|
||||||
|
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 } = buildParameters;
|
const { path, dockerfile, baseImage, uid, gid } = 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 });
|
||||||
|
|
@ -83,6 +86,9 @@ 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