Skip to content

Commit

Permalink
Add WebGL Job
Browse files Browse the repository at this point in the history
  • Loading branch information
VeyronSakai committed Apr 26, 2024
1 parent b8ab089 commit bb1b3b2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,23 @@ jobs:
-nographics \
-projectPath "$(pwd)" \
-executeMethod Editor.BuildEntryPoint.BuildMacOS
webgl:
runs-on: [ self-hosted, macOS ]
steps:
- name: Switch workspace
uses: DeNA/setup-job-workspace-action@fea4ef4d011492fe235833241acbb4fced82da27
- uses: actions/checkout@v4
with:
clean: "${{ env.CLEAN }}"
- name: Get Unity version
run:
echo "UNITY_VERSION=$(grep "m_EditorVersion:" < ProjectSettings/ProjectVersion.txt | cut -d" " -f2)" >> "${GITHUB_ENV}"
- name: macOS Build
run: |
/Applications/Unity/Hub/Editor/"${UNITY_VERSION}"/Unity.app/Contents/MacOS/Unity \
-quit \
-batchmode \
-nographics \
-projectPath "$(pwd)" \
-executeMethod Editor.BuildEntryPoint.BuildWebGL
27 changes: 22 additions & 5 deletions Assets/Editor/BuildEntryPoint.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
using Codice.Client.BaseCommands;
using UnityEditor;

namespace Editor
{
// ReSharper disable once UnusedMember.Global
public sealed class BuildEntryPoint
{
private const string Scenes = "Assets/Scenes/SampleScene.unity";

// ReSharper disable once UnusedMember.Global
public static void BuildAndroid()
{
var buildPlayerOptions = new BuildPlayerOptions
{
scenes = new[] { "Assets/Scenes/SampleScene.unity" },
scenes = new[] { Scenes },
locationPathName = "Outputs/Android/Sample.apk",
target = BuildTarget.Android,
options = BuildOptions.Development,
Expand All @@ -24,8 +27,8 @@ public static void BuildIOS()
{
var buildPlayerOptions = new BuildPlayerOptions
{
scenes = new[] { "Assets/Scenes/SampleScene.unity" },
locationPathName = "Outputs/IOS/",
scenes = new[] { Scenes },
locationPathName = "Outputs/IOS",
target = BuildTarget.iOS,
options = BuildOptions.Development,
};
Expand All @@ -38,13 +41,27 @@ public static void BuildMacOS()
{
var buildPlayerOptions = new BuildPlayerOptions
{
scenes = new[] { "Assets/Scenes/SampleScene.unity" },
locationPathName = "Outputs/MacOS/Sample.app",
scenes = new[] { Scenes },
locationPathName = "Outputs/MacOS",
target = BuildTarget.StandaloneOSX,
options = BuildOptions.Development,
};

BuildPipeline.BuildPlayer(buildPlayerOptions);
}

// ReSharper disable once UnusedMember.Global
public static void BuildWebGL()
{
var buildPlayerOptions = new BuildPlayerOptions
{
scenes = new[] { Scenes },
locationPathName = "Outputs/WebGL",
target = BuildTarget.WebGL,
options = BuildOptions.Development,
};

BuildPipeline.BuildPlayer(buildPlayerOptions);
}
}
}

0 comments on commit bb1b3b2

Please sign in to comment.