-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
760 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Acquire activation file | ||
on: [ workflow_dispatch ] | ||
jobs: | ||
activation: | ||
name: Request manual activation file 🔑 | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Request manual activation file | ||
- name: Request manual activation file | ||
id: getManualLicenseFile | ||
uses: game-ci/unity-request-activation-file@v2 | ||
# Upload artifact (Unity_v20XX.X.XXXX.alf) | ||
- name: Expose as artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.getManualLicenseFile.outputs.filePath }} | ||
path: ${{ steps.getManualLicenseFile.outputs.filePath }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
name: Build | ||
|
||
on: [ push, pull_request, workflow_dispatch ] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
unity-version: | ||
- 2020.3.22f1 # Among Us | ||
- 2022.2.6f1 | ||
- 2021.3.18f1 | ||
- 2020.3.44f1 | ||
- 2019.4.40f1 | ||
- 2018.4.36f1 | ||
target-platform: [ StandaloneWindows64, StandaloneWindows, StandaloneLinux64, StandaloneOSX, Android ] | ||
scripting-backend: [ Mono, IL2CPP ] | ||
|
||
exclude: | ||
# Unity versions before 2019.3 do not support il2cpp | ||
- unity-version: 2018.4.36f1 | ||
scripting-backend: IL2CPP | ||
# https://github.com/game-ci/unity-builder/issues/489 | ||
- unity-version: 2022.2.6f1 | ||
target-platform: Android | ||
# x32 linux is not supported by game-ci | ||
#include: | ||
# - unity-version: 2018.4.36f1 | ||
# target-platform: StandaloneLinux | ||
# scripting-backend: Mono | ||
|
||
runs-on: ${{ | ||
(startsWith( matrix.target-platform, 'StandaloneWindows' ) && matrix.scripting-backend == 'IL2CPP') && 'windows-2019' || | ||
(startsWith( matrix.target-platform, 'StandaloneOSX' ) && matrix.scripting-backend == 'IL2CPP') && 'macos-latest' || | ||
'ubuntu-latest' | ||
}} | ||
name: ${{ matrix.unity-version }} ${{ matrix.target-platform }} ${{ matrix.scripting-backend }} | ||
|
||
steps: | ||
- id: set-vars | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const scriptingBackend = "${{ matrix.scripting-backend }}"; | ||
core.setOutput("scripting-backend", scriptingBackend === "Mono" ? "Mono2x" : scriptingBackend); | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: Library | ||
key: | ||
Library-${{ matrix.target-platform }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | ||
restore-keys: | | ||
Library-${{ matrix.target-platform }}- | ||
Library- | ||
- uses: js6pak/unity-builder@main | ||
timeout-minutes: 60 | ||
env: | ||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
with: | ||
unityVersion: ${{ matrix.unity-version }} | ||
targetPlatform: ${{ matrix.target-platform }} | ||
versioning: None | ||
allowDirtyBuild: true | ||
buildName: TestGame | ||
buildMethod: UnityBuilderAction.Builder.BuildProject | ||
customParameters: -scriptingBackend ${{ steps.set-vars.outputs.scripting-backend }} | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: TestGame-${{ matrix.unity-version }}-${{ matrix.target-platform }}-${{ matrix.scripting-backend }} | ||
path: ./build/${{ matrix.target-platform }} | ||
|
||
- shell: bash | ||
run: | | ||
7z a -tzip "${{ matrix.unity-version }}-${{ matrix.target-platform }}-${{ matrix.scripting-backend }}.zip" ./build/${{ matrix.target-platform }}/* | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: TestGame | ||
path: "${{ matrix.unity-version }}-${{ matrix.target-platform }}-${{ matrix.scripting-backend }}.zip" | ||
|
||
create_release: | ||
if: github.event_name != 'pull_request' | ||
permissions: | ||
contents: write | ||
needs: | ||
- build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: artifacts | ||
- name: Collect files | ||
id: collect-info | ||
run: | | ||
mkdir release | ||
cd artifacts | ||
for i in */; do (cd "${i%/}" && zip -0 -r "../../release/${i%/}.zip" *) & done; wait | ||
- name: Create release | ||
uses: marvinpinto/action-automatic-releases@latest | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: ${{ github.ref_type != 'tag' }} | ||
automatic_release_tag: ${{ github.ref_type != 'tag' && 'latest' || null }} | ||
title: ${{ github.ref_type != 'tag' && format('Build {0}', github.run_number) || null }} | ||
files: | | ||
release/*.zip |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Reflection; | ||
using UnityBuilderAction.Input; | ||
using UnityBuilderAction.Reporting; | ||
using UnityBuilderAction.Versioning; | ||
using UnityEditor; | ||
using UnityEditor.Build.Reporting; | ||
using Debug = UnityEngine.Debug; | ||
|
||
namespace UnityBuilderAction | ||
{ | ||
static class Builder | ||
{ | ||
public static void BuildProject() | ||
{ | ||
// Gather values from args | ||
var options = ArgumentsParser.GetValidatedOptions(); | ||
|
||
string rawScriptingBackend; | ||
if (options.TryGetValue("scriptingBackend", out rawScriptingBackend)) | ||
{ | ||
var scriptingBackend = (ScriptingImplementation)Enum.Parse(typeof(ScriptingImplementation), rawScriptingBackend); | ||
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Standalone, scriptingBackend); | ||
} | ||
|
||
// Gather values from project | ||
var scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(s => s.path).ToArray(); | ||
|
||
// Get all buildOptions from options | ||
BuildOptions buildOptions = BuildOptions.None; | ||
foreach (string buildOptionString in Enum.GetNames(typeof(BuildOptions))) { | ||
if (options.ContainsKey(buildOptionString)) { | ||
BuildOptions buildOptionEnum = (BuildOptions) Enum.Parse(typeof(BuildOptions), buildOptionString); | ||
buildOptions |= buildOptionEnum; | ||
} | ||
} | ||
|
||
// Define BuildPlayer Options | ||
var buildPlayerOptions = new BuildPlayerOptions { | ||
scenes = scenes, | ||
locationPathName = options["customBuildPath"], | ||
target = (BuildTarget) Enum.Parse(typeof(BuildTarget), options["buildTarget"]), | ||
options = buildOptions | ||
}; | ||
|
||
// Set version for this build | ||
VersionApplicator.SetVersion(options["buildVersion"]); | ||
|
||
// Apply Android settings | ||
if (buildPlayerOptions.target == BuildTarget.Android) | ||
{ | ||
VersionApplicator.SetAndroidVersionCode(options["androidVersionCode"]); | ||
AndroidSettings.Apply(options); | ||
} | ||
|
||
// Execute default AddressableAsset content build, if the package is installed. | ||
// Version defines would be the best solution here, but Unity 2018 doesn't support that, | ||
// so we fall back to using reflection instead. | ||
var addressableAssetSettingsType = Type.GetType( | ||
"UnityEditor.AddressableAssets.Settings.AddressableAssetSettings,Unity.Addressables.Editor"); | ||
if (addressableAssetSettingsType != null) | ||
{ | ||
// ReSharper disable once PossibleNullReferenceException, used from try-catch | ||
try | ||
{ | ||
addressableAssetSettingsType.GetMethod("CleanPlayerContent", BindingFlags.Static | BindingFlags.Public) | ||
.Invoke(null, new object[] {null}); | ||
addressableAssetSettingsType.GetMethod("BuildPlayerContent", new Type[0]).Invoke(null, new object[0]); | ||
} | ||
catch (Exception e) | ||
{ | ||
Debug.LogError($"Failed to run default addressables build:\n{e}"); | ||
} | ||
} | ||
|
||
// Perform build | ||
BuildReport buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions); | ||
|
||
// Summary | ||
BuildSummary summary = buildReport.summary; | ||
StdOutReporter.ReportSummary(summary); | ||
|
||
// Result | ||
BuildResult result = summary.result; | ||
StdOutReporter.ExitWithResult(result); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.