Compare commits

...

6 Commits
v1.4 ... v1.x

Author SHA1 Message Date
Webber Takken
17c28995b2 Update action to use main (#168) 2020-10-29 23:21:48 +01:00
Devashish Lal
21c985b8e9 added -nographics flag to build.sh (#166) 2020-10-22 16:05:41 +02:00
Kai Biermeier
e6d3daedbe revert Fix file ownership issues for self-hosted runners. (#141) (#165) 2020-10-22 10:20:12 +02:00
Webber Takken
ef74241772 Fix recursive path (#160) 2020-10-12 19:37:26 +02:00
dependabot[bot]
3d7e4a8018 Bump @actions/core from 1.2.4 to 1.2.6 (#158)
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.4 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-01 21:30:09 +02:00
Webber Takken
91da660786 remove artifacts older than 21 days (#157) 2020-09-28 19:19:18 +02:00
10 changed files with 25 additions and 36 deletions

13
.github/workflows/cleanup.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: Delete old artifacts
on:
schedule:
- cron: '30 10 * * *' # every day at 10:30
jobs:
delete-artifacts:
runs-on: ubuntu-latest
steps:
- uses: kolpav/purge-artifacts-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
expire-in: 21 days

View File

@@ -2,7 +2,7 @@ name: Actions
on:
pull_request: {}
push: { branches: [master] }
push: { branches: [main] }
env:
CODECOV_TOKEN: '2f2eb890-30e2-4724-83eb-7633832cf0de'

View File

@@ -1,10 +1,6 @@
ARG IMAGE
FROM $IMAGE
ARG UNAME=runner
ARG UID=1000
ARG GID=1000
LABEL "com.github.actions.name"="Unity - Builder"
LABEL "com.github.actions.description"="Build Unity projects for different platforms."
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 "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 steps /steps
RUN chmod -R +x /steps
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
USER $UID:$GID

File diff suppressed because one or more lines are too long

3
action/steps/build.sh Normal file → Executable file
View File

@@ -48,7 +48,7 @@ if [ -z "$BUILD_METHOD" ]; then
# Create Editor directory if it does not exist
mkdir -p "$UNITY_PROJECT_PATH/Assets/Editor/"
# Copy the build script of Unity Builder action
cp -r "/UnityBuilderAction/Assets/Editor" "$UNITY_PROJECT_PATH/Assets/Editor/"
cp -R "/UnityBuilderAction/Assets/Editor/" "$UNITY_PROJECT_PATH/Assets/Editor/"
# Set the Build method to that of UnityBuilder Action
BUILD_METHOD="UnityBuilderAction.Builder.BuildProject"
# Verify recursive paths
@@ -111,6 +111,7 @@ echo ""
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \
-batchmode \
-nographics \
-logfile /dev/stdout \
-quit \
-customBuildName "$BUILD_NAME" \

View File

@@ -14,7 +14,7 @@
"test": "jest"
},
"dependencies": {
"@actions/core": "^1.2.4",
"@actions/core": "^1.2.6",
"@actions/exec": "1.0.4",
"@actions/github": "^2.1.1",
"base-64": "^0.1.0",

View File

@@ -16,13 +16,7 @@ async function action() {
} else {
// Build docker image
// TODO: No image required (instead use a version published to dockerhub for the action, supply credentials for github cloning)
const builtImage = await Docker.build({
path: actionFolder,
dockerfile,
baseImage,
uid: buildParameters.uid,
gid: buildParameters.gid,
});
const builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
await Docker.run(builtImage, { workspace, ...buildParameters });
}

View File

@@ -1,4 +1,3 @@
import os from 'os';
import AndroidVersioning from './android-versioning';
import Input from './input';
import Platform from './platform';
@@ -21,13 +20,10 @@ class BuildParameters {
Input.androidVersionCode,
);
const { uid, gid } = os.userInfo();
return {
version: Input.unityVersion,
customImage: Input.customImage,
uid,
gid,
runnerTempPath: process.env.RUNNER_TEMP,
platform: Input.targetPlatform,
projectPath: Input.projectPath,

View File

@@ -1,18 +1,15 @@
import fs from 'fs';
import { exec } from '@actions/exec';
import ImageTag from './image-tag';
class Docker {
static async build(buildParameters, silent = false) {
const { path, dockerfile, baseImage, uid, gid } = buildParameters;
const { path, dockerfile, baseImage } = buildParameters;
const { version, platform } = baseImage;
const tag = new ImageTag({ repository: '', name: 'unity-builder', version, platform });
const command = `docker build ${path} \
--file ${dockerfile} \
--build-arg IMAGE=${baseImage} \
--build-arg UID=${uid} \
--build-arg GID=${gid} \
--tag ${tag}`;
await exec(command, undefined, { silent });
@@ -86,9 +83,6 @@ class Docker {
--volume "${workspace}":"/github/workspace" \
${image}`;
fs.mkdirSync(`${runnerTempPath}/_github_home`, { recursive: true });
fs.mkdirSync(`${runnerTempPath}/_github_workflow`, { recursive: true });
await exec(command, undefined, { silent });
}
}

View File

@@ -2,9 +2,10 @@
# yarn lockfile v1
"@actions/core@^1.2.4":
version "1.2.4"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.4.tgz#96179dbf9f8d951dd74b40a0dbd5c22555d186ab"
"@actions/core@^1.2.6":
version "1.2.6"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.2.6.tgz#a78d49f41a4def18e88ce47c2cac615d5694bf09"
integrity sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==
"@actions/exec@1.0.4":
version "1.0.4"