Compare commits

...

15 Commits
v0.5 ... v0.8

Author SHA1 Message Date
Webber
1d1f81c0bb Refactor models to allow for build parameters...
Build parameters have to be parsed because they can no longer be implicitly passed, as they need to be interpreted for detecting extensions.
2020-01-21 00:28:05 +01:00
Webber
a84535fc04 Add initial contributing doc 2020-01-19 01:54:56 +01:00
Webber
a2db13a084 Add code of conduct 2020-01-19 01:54:56 +01:00
Webber
b6f8dac777 Hardcode license file, in order to fix pr workflows 2020-01-19 01:22:42 +01:00
Webber
1de4638512 Remove duplicate trigger for test workflow 2020-01-18 23:44:40 +01:00
Webber
4b07d18a89 Trigger test workflow for PRs too 2020-01-18 23:27:33 +01:00
Webber Takken
adb8cfef12 add check to verify dist files (#21)
* add check to verify dist files
* change src, without running git hooks (expect failure)
* change src again, now do run commit hook (expect success)
* cleanup before squash
2020-01-18 23:23:53 +01:00
Webber
57d2023972 Trigger badge update for pushes to master only...
Which includes merging pull requests, as the latest commit gets pushed to master.
2020-01-18 22:29:29 +01:00
Webber
d2be807d0d update out of sync index file 2020-01-18 21:12:23 +01:00
Jibbajabbafic
99bb63390a Updated comments to match existing style 2020-01-17 16:52:21 +01:00
Jibbajabbafic
d27df56d26 fix(activate): only exit if activation fails 2020-01-17 16:52:21 +01:00
Jibbajabbafic
a6607a341e feat(activate): add more checks for licenses 2020-01-17 16:52:21 +01:00
Jibbajabbafic
2d3095660d fix(license): only return the license in pro mode 2020-01-12 22:02:05 +01:00
Dan Vicarel
0badec78bf GitHub Action now sets Pro licensing env vars as well 2020-01-12 17:51:45 +01:00
Dan Vicarel
c3b8284b44 docker.js now sets variables for Pro licenses as well 2020-01-12 17:51:45 +01:00
17 changed files with 341 additions and 136 deletions

View File

@@ -11,7 +11,7 @@ tab_width = 2
trim_trailing_whitespace = true
[*.md]
max_line_length = 0
max_line_length = off
trim_trailing_whitespace = false
[COMMIT_EDITMSG]

View File

@@ -5,7 +5,7 @@ on:
push: { branches: [master] }
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_LICENSE: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root>\n <License id=\"Terms\">\n <MachineBindings>\n <Binding Key=\"1\" Value=\"d39b8e2f4d364b2e98b06afa0c6e08c5\"/>\n <Binding Key=\"2\" Value=\"d39b8e2f4d364b2e98b06afa0c6e08c5\"/>\n </MachineBindings>\n <MachineID Value=\"Xxo1ZKbdPu/IATrc0mPBYANJFF0=\"/>\n <SerialHash Value=\"1efd68fa935192b6090ac03c77d289a9f588c55a\"/>\n <Features>\n <Feature Value=\"33\"/>\n <Feature Value=\"1\"/>\n <Feature Value=\"12\"/>\n <Feature Value=\"2\"/>\n <Feature Value=\"24\"/>\n <Feature Value=\"3\"/>\n <Feature Value=\"36\"/>\n <Feature Value=\"17\"/>\n <Feature Value=\"19\"/>\n <Feature Value=\"62\"/>\n </Features>\n <DeveloperData Value=\"AQAAAEY0LUg2WFMtUE00NS1SM0M4LUUyWlotWkdWOA==\"/>\n <SerialMasked Value=\"F4-H6XS-PM45-R3C8-E2ZZ-XXXX\"/>\n <StartDate Value=\"2018-05-02T00:00:00\"/>\n <UpdateDate Value=\"2019-11-25T18:23:38\"/>\n <InitialActivationDate Value=\"2018-05-02T14:21:28\"/>\n <LicenseVersion Value=\"6.x\"/>\n <ClientProvidedVersion Value=\"2019.2.11f1\"/>\n <AlwaysOnline Value=\"false\"/>\n <Entitlements>\n <Entitlement Ns=\"unity_editor\" Tag=\"UnityPersonal\" Type=\"EDITOR\" ValidTo=\"9999-12-31T00:00:00\"/>\n </Entitlements>\n </License>\n<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\"/><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/><Reference URI=\"#Terms\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\"/></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>JHdOBFmBNq2H8BrGFzir/StLoYo=</DigestValue></Reference></SignedInfo><SignatureValue>aENLHd37a51RtP2/g7YU0Pexf5mx0/ENXYGtrPzqwZ8NQt2AsSdxGnl0CUB45/GuNXfJVDt2HWot\ncNYZB2OylVBn1WHQbKZlPmm8gEAMz0MYbr4Isb5i5buryBrZlmbEOjnRI+pEg1CBwlgMo6xdtjjE\n/d7cC293QIUO91kdzRXftYou1dNaUyuPL9ZH65vdB2pDXGRNxgUVD+GnnqZA7b5L2HXqNQclcWAK\n5Yd1BeF3VzR1iLw9G/SmH5oOhnpXSmqbL4qk7LVP2/mgXpFk5kP4X8VC3z47obNhBIGq40dwWyEe\nUYk5/nRAOkZawDT+tcu96e06gPC9Cxk5PdbRbA==</SignatureValue></Signature></root>"
jobs:
buildForAllPlatforms:

View File

@@ -1,6 +1,8 @@
name: Test Action
on: [push]
on:
pull_request: {}
push: { branches: [master] }
jobs:
build:
@@ -13,3 +15,5 @@ jobs:
- run: yarn
- run: yarn lint
- run: yarn test
- run: yarn build || { echo "build command should always succeed" ; exit 61; }
- run: yarn build --quiet && git diff --quiet builder || { echo "builder should be auto generated" ; exit 62; }

76
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at webber@takken.io. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

39
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,39 @@
# Contributing
## How to Contribute
#### Code of Conduct
This repository has adopted the Contributor Covenant as it's
Code of Conduct. It is expected that participants adhere to it.
#### Proposing a Change
If you are unsure about whether or not a change is desired,
you can create an issue. This is useful because it creates
the possibility for a discussion that's visible to everyone.
When fixing a bug it is fine to submit a pull request right away.
#### Sending a Pull Request
Steps to be performed to submit a pull request:
1. Fork the repository and create your branch from `master`.
2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Fill out the description, link any related issues and submit your pull request.
#### Pull Request Prerequisites
You have [Node](https://nodejs.org/) installed at v12.2.0+ and [Yarn](https://yarnpkg.com/) at v1.18.0+.
Please note that commit hooks will run automatically to perform some tasks;
- format your code
- run tests
- build distributable files
#### License
By contributing to this repository, you agree that your contributions will be licensed under its MIT license.

View File

@@ -1,6 +1,6 @@
# Unity - Builder
[![Actions status](https://github.com/webbertakken/unity-builder/workflows/Actions%20%F0%9F%98%8E/badge.svg)](https://github.com/webbertakken/unity-builder/actions?query=branch%3Amaster+workflow%3A%22Actions+%F0%9F%98%8E%22)
[![Actions status](https://github.com/webbertakken/unity-builder/workflows/Actions%20%F0%9F%98%8E/badge.svg?event=push&branch=master)](https://github.com/webbertakken/unity-builder/actions?query=branch%3Amaster+event%3Apush+workflow%3A%22Actions+%F0%9F%98%8E%22)
---
@@ -127,10 +127,10 @@ _**required:** `true`_
#### buildName
Name of the build.
Name of the build. Also the folder in which the build will be stored within `buildsPath`.
_**required:** `false`_
_**default:** `testBuild`_
_**default:** `<build_target>`_
#### buildsPath

File diff suppressed because one or more lines are too long

View File

@@ -10,6 +10,7 @@ if [[ -n "$UNITY_LICENSE" ]]; then
# * See for more details: https://gitlab.com/gableroux/unity3d-gitlab-ci-example/issues/5#note_72815478
#
# The license file can be acquired using `webbertakken/request-manual-activation-file` action.
LICENSE_MODE="personal"
# Set the license file path
FILE_PATH=UnityLicenseFile.ulf
@@ -42,23 +43,10 @@ if [[ -n "$UNITY_LICENSE" ]]; then
# TODO - Derive exit code by grepping success statement
UNITY_EXIT_CODE=$(echo $ACTIVATION_OUTPUT | grep 'config is NOT valid, switching to default' | wc -l)
# Display information about the result
if [ $UNITY_EXIT_CODE -eq 0 ]; then
echo "Activation (personal) complete."
else
echo "Unclassified error occured while trying to activate (personal) license."
echo "Exit code was: $UNITY_EXIT_CODE"
fi
# Remove license file
rm -f $FILE_PATH
# Exit with the code from the license verification step
if [ $UNITY_EXIT_CODE -ne 0 ]; then
exit $UNITY_EXIT_CODE
fi
else
elif [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
#
# PROFESSIONAL (SERIAL) LICENSE MODE
#
@@ -66,6 +54,8 @@ else
#
# Note: This is the preferred way for PROFESSIONAL LICENSES.
#
LICENSE_MODE="professional"
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \
-batchmode \
@@ -79,15 +69,29 @@ else
# Store the exit code from the verify command
UNITY_EXIT_CODE=$?
# Display information about the result
if [ $UNITY_EXIT_CODE -eq 0 ]; then
echo "Activation (professional) complete."
else
echo "Unclassified error occured while trying to activate (professional) license."
echo "Exit code was: $UNITY_EXIT_CODE"
fi
# Exit with the code from the license verification step
exit $UNITY_EXIT_CODE
else
#
# LICENSE ACTIVATION FAILED
#
# This will exit since both personal and professional activation modes failed
#
echo "No personal or professional licenses provided!"
echo "Please ensure you have setup one of these licensing methods:"
echo " - Personal: Set the UNITY_LICENSE environment variable."
echo " - Professional: Set the UNITY_EMAIL, UNITY_PASSWORD and UNITY_SERIAL environment variables."
echo "See https://github.com/webbertakken/unity-builder#usage for details."
exit 1;
fi
#
# Display information about the result
#
if [ $UNITY_EXIT_CODE -eq 0 ]; then
# Activation was a success
echo "Activation ($LICENSE_MODE) complete."
else
# Activation failed so exit with the code from the license verification step
echo "Unclassified error occured while trying to activate ($LICENSE_MODE) license."
echo "Exit code was: $UNITY_EXIT_CODE"
exit $UNITY_EXIT_CODE
fi

View File

@@ -4,53 +4,28 @@
# Set project path
#
UNITY_PROJECT_PATH=$GITHUB_WORKSPACE/$PROJECT_PATH
UNITY_PROJECT_PATH="$GITHUB_WORKSPACE/$PROJECT_PATH"
echo "Using project path \"$UNITY_PROJECT_PATH\"."
#
# Set the name for the build
# Display the name for the build, doubles as the output name
#
if [ -z "$BUILD_NAME" ]; then
BUILD_NAME="build-$(date '+%F-%H%M')"
fi
echo "Using build name \"$BUILD_NAME\"."
#
# Set the builds target platform;
#
# Web: WebGL
# Desktop: StandaloneOSX, StandaloneWindows, StandaloneWindows64, StandaloneLinux64
# Console: PS4, XboxOne, Switch
# Mobile: Android, iOS
# Other: tvOS, Lumin, BJM, WSAPlayer
#
# Default to WebGL (no particular reason)
# Display the build's target platform;
#
if [ -z "$BUILD_TARGET" ]; then
BUILD_TARGET=WebGL
fi
echo "Using build target \"$BUILD_TARGET\"."
#
# Set builds path
# Display build path and file
#
if [ -z "$BUILDS_PATH" ]; then
BUILDS_PATH=build
fi
BUILDS_FULL_PATH=$GITHUB_WORKSPACE/$BUILDS_PATH
# TODO - Cleanup
BUILD_FOLDER=$BUILD_TARGET-$UNITY_VERSION
CURRENT_BUILD_PATH=$BUILDS_PATH/$BUILD_FOLDER
CURRENT_BUILD_FULL_PATH=$BUILDS_FULL_PATH/$BUILD_FOLDER
# TODO - Determine the file or folder based on BUILD_TARGET
CUSTOM_BUILD_PATH=$BUILDS_FULL_PATH/$BUILD_FOLDER/$BUILD_TARGET
echo "Using build path \"$CURRENT_BUILD_PATH\"."
echo "Using build path \"$BUILD_PATH\" to save file \"$BUILD_FILE\"."
BUILD_PATH_FULL="$GITHUB_WORKSPACE/$BUILD_PATH"
CUSTOM_BUILD_PATH="$BUILD_PATH_FULL/$BUILD_FILE"
#
# Set the build method, must reference one of:
@@ -71,13 +46,13 @@ if [ -z "$BUILD_METHOD" ]; then
#
echo "Using built-in build method."
# Create Editor directory if it does not exist
mkdir -p $UNITY_PROJECT_PATH/Assets/Editor/
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
ls -Ralph $UNITY_PROJECT_PATH/Assets/Editor/
ls -Ralph "$UNITY_PROJECT_PATH/Assets/Editor/"
#
else
# User has provided their own build method.
@@ -98,25 +73,15 @@ EXECUTE_BUILD_METHOD="-executeMethod $BUILD_METHOD"
# Build info
#
echo ""
echo "###########################"
echo "# All builds dir #"
echo "###########################"
echo ""
echo "Creating \"$BUILDS_FULL_PATH\" if it does not exist."
mkdir -p $BUILDS_FULL_PATH
ls -alh $BUILDS_FULL_PATH
echo ""
echo "###########################"
echo "# Current build dir #"
echo "###########################"
echo ""
echo "Creating \"$CURRENT_BUILD_FULL_PATH\" if it does not exist."exist."
mkdir -p $CURRENT_BUILD_FULL_PATH
ls -alh $CURRENT_BUILD_FULL_PATH
echo "Creating \"$BUILD_PATH_FULL\" if it does not exist."
mkdir -p "$BUILD_PATH_FULL"
ls -alh "$BUILD_PATH_FULL"
echo ""
echo "###########################"
@@ -164,4 +129,4 @@ echo "# Build directory #"
echo "###########################"
echo ""
ls -alh $CURRENT_BUILD_FULL_PATH
ls -alh "$BUILD_PATH_FULL"

View File

@@ -1,14 +1,16 @@
#!/usr/bin/env bash
#
# PROFESSIONAL (SERIAL) LICENSE MODE
#
# This will return the license that is currently in use.
#
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \
-batchmode \
-nographics \
-logFile /dev/stdout \
-quit \
-returnlicense
if [[ -n "$UNITY_SERIAL" ]]; then
#
# PROFESSIONAL (SERIAL) LICENSE MODE
#
# This will return the license that is currently in use.
#
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24' \
/opt/Unity/Editor/Unity \
-batchmode \
-nographics \
-logFile /dev/stdout \
-quit \
-returnlicense
fi

View File

@@ -2,6 +2,7 @@ import Action from './model/action';
import Docker from './model/docker';
import ImageTag from './model/image-tag';
import Input from './model/input';
import BuildParameters from './model/build-parameters';
const core = require('@actions/core');
@@ -9,12 +10,14 @@ async function action() {
Action.checkCompatibility();
const { dockerfile, workspace, builderFolder } = Action;
const { version, platform, projectPath, buildName, buildsPath, method } = Input.getFromUser();
const buildParameters = BuildParameters.create(Input.getFromUser());
const baseImage = new ImageTag(buildParameters);
const baseImage = new ImageTag({ version, platform });
// Build docker image
const builtImage = await Docker.build({ path: builderFolder, dockerfile, baseImage });
await Docker.run(builtImage, { workspace, platform, projectPath, buildName, buildsPath, method });
// Run docker image
await Docker.run(builtImage, { workspace, ...buildParameters });
}
action().catch(error => {

View File

@@ -1,6 +1,6 @@
import path from 'path';
export default class Action {
class Action {
static get supportedPlatforms() {
return ['linux'];
}
@@ -44,3 +44,5 @@ export default class Action {
}
}
}
export default Action;

View File

@@ -0,0 +1,38 @@
import Platform from './platform';
class BuildParameters {
static create(parameters) {
const {
unityVersion,
targetPlatform,
projectPath,
buildName,
buildsPath,
buildMethod,
} = parameters;
return {
version: unityVersion,
platform: targetPlatform,
projectPath,
buildName,
buildPath: `${buildsPath}/${targetPlatform}`,
buildFile: this.parseBuildFile(buildName, targetPlatform),
buildMethod,
};
}
static parseBuildFile(filename, platform) {
if (Platform.isWindows(platform)) {
return `${filename}.exe`;
}
if (Platform.isAndroid(platform)) {
return `${filename}.apk`;
}
return filename;
}
}
export default BuildParameters;

View File

@@ -1,7 +1,7 @@
import { exec } from '@actions/exec';
import ImageTag from './image-tag';
export default class Docker {
class Docker {
static async build(buildParameters, silent = false) {
const { path, dockerfile, baseImage } = buildParameters;
const { version, platform } = baseImage;
@@ -18,19 +18,31 @@ export default class Docker {
}
static async run(image, parameters, silent = false) {
const { workspace, platform, projectPath, buildName, buildsPath, method } = parameters;
const { version } = image;
const {
version,
workspace,
platform,
projectPath,
buildName,
buildPath,
buildFile,
buildMethod,
} = parameters;
const command = `docker run \
--workdir /github/workspace \
--rm \
--env UNITY_LICENSE \
--env UNITY_EMAIL \
--env UNITY_PASSWORD \
--env UNITY_SERIAL \
--env UNITY_VERSION=${version} \
--env PROJECT_PATH=${projectPath} \
--env BUILD_TARGET=${platform} \
--env BUILD_NAME=${buildName} \
--env BUILDS_PATH=${buildsPath} \
--env BUILD_METHOD=${method} \
--env BUILD_PATH=${buildPath} \
--env BUILD_FILE=${buildFile} \
--env BUILD_METHOD=${buildMethod} \
--env HOME=/github/home \
--env GITHUB_REF \
--env GITHUB_SHA \
@@ -56,3 +68,5 @@ export default class Docker {
await exec(command, null, { silent });
}
}
export default Docker;

View File

@@ -1,6 +1,7 @@
import { has, get, trimEnd, trimStart } from 'lodash-es';
import Platform from './platform';
export default class ImageTag {
class ImageTag {
constructor(imageProperties) {
const {
repository = 'gableroux',
@@ -13,14 +14,14 @@ export default class ImageTag {
throw new Error(`Invalid version "${version}".`);
}
if (!has(ImageTag.targetPlatformToBuilderPlatformMap, platform)) {
if (!has(ImageTag.targetPlatformToImageSuffixMap, platform)) {
throw new Error(`Platform "${platform}" is currently not supported.`);
}
const builderPlatform = get(
ImageTag.targetPlatformToBuilderPlatformMap,
ImageTag.targetPlatformToImageSuffixMap,
platform,
ImageTag.builderPlatforms.generic,
ImageTag.imageSuffixes.generic,
);
Object.assign(this, { repository, name, version, platform, builderPlatform });
@@ -30,7 +31,7 @@ export default class ImageTag {
return /^20\d{2}\.\d\.\w{3,4}|3$/;
}
static get builderPlatforms() {
static get imageSuffixes() {
return {
generic: '',
webgl: 'webgl',
@@ -42,31 +43,31 @@ export default class ImageTag {
};
}
static get targetPlatformToBuilderPlatformMap() {
const { generic, webgl, mac, windows, android, ios, facebook } = ImageTag.builderPlatforms;
static get targetPlatformToImageSuffixMap() {
const { generic, webgl, mac, windows, android, ios, facebook } = ImageTag.imageSuffixes;
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
return {
StandaloneOSX: mac,
StandaloneWindows: windows,
StandaloneWindows64: windows,
StandaloneLinux64: windows,
iOS: ios,
Android: android,
WebGL: webgl,
WSAPlayer: windows,
PS4: windows,
XboxOne: windows,
tvOS: windows,
Switch: windows,
[Platform.types.StandaloneOSX]: mac,
[Platform.types.StandaloneWindows]: windows,
[Platform.types.StandaloneWindows64]: windows,
[Platform.types.StandaloneLinux64]: windows,
[Platform.types.iOS]: ios,
[Platform.types.Android]: android,
[Platform.types.WebGL]: webgl,
[Platform.types.WSAPlayer]: windows,
[Platform.types.PS4]: windows,
[Platform.types.XboxOne]: windows,
[Platform.types.tvOS]: windows,
[Platform.types.Switch]: windows,
// Unsupported
Lumin: windows,
BJM: windows,
Stadia: windows,
Facebook: facebook,
NoTarget: generic,
[Platform.types.Lumin]: windows,
[Platform.types.BJM]: windows,
[Platform.types.Stadia]: windows,
[Platform.types.Facebook]: facebook,
[Platform.types.NoTarget]: generic,
// Test specific
Test: generic,
[Platform.types.Test]: generic,
};
}
@@ -84,3 +85,5 @@ export default class ImageTag {
return `${image}:${tag}`;
}
}
export default ImageTag;

View File

@@ -1,22 +1,26 @@
import Platform from './platform';
const core = require('@actions/core');
export default class Input {
class Input {
static getFromUser() {
// Input variables specified in workflows using "with" prop.
const version = core.getInput('unityVersion');
const platform = core.getInput('targetPlatform');
const unityVersion = core.getInput('unityVersion');
const targetPlatform = core.getInput('targetPlatform') || Platform.default;
const projectPath = core.getInput('projectPath');
const buildName = core.getInput('buildName');
const buildsPath = core.getInput('buildsPath');
const buildMethod = core.getInput('buildMethod');
const buildName = core.getInput('buildName') || targetPlatform;
const buildsPath = core.getInput('buildsPath') || 'build';
const buildMethod = core.getInput('buildMethod'); // processed in docker file
return {
version,
platform,
unityVersion,
targetPlatform,
projectPath,
buildName,
buildsPath,
method: buildMethod,
buildMethod,
};
}
}
export default Input;

51
src/model/platform.js Normal file
View File

@@ -0,0 +1,51 @@
class Platform {
static get default() {
return Platform.types.StandaloneWindows64;
}
static get types() {
return {
StandaloneOSX: 'StandaloneOSX',
StandaloneWindows: 'StandaloneWindows',
StandaloneWindows64: 'StandaloneWindows64',
StandaloneLinux64: 'StandaloneLinux64',
iOS: 'iOS',
Android: 'Android',
WebGL: 'WebGL',
WSAPlayer: 'WSAPlayer',
PS4: 'PS4',
XboxOne: 'XboxOne',
tvOS: 'tvOS',
Switch: 'Switch',
// Unsupported
Lumin: 'Lumin',
BJM: 'BJM',
Stadia: 'Stadia',
Facebook: 'Facebook',
NoTarget: 'NoTarget',
// Test specific
Test: 'Test',
};
}
static isWindows(platform) {
switch (platform) {
case Platform.types.StandaloneWindows:
case Platform.types.StandaloneWindows64:
return true;
default:
return false;
}
}
static isAndroid(platform) {
switch (platform) {
case Platform.types.Android:
return true;
default:
return false;
}
}
}
export default Platform;