mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-07-24 11:40:45 -05:00
Merge pull request #2565 from vrm-c/workflow-webgl-wip
[WebGL] github action でサンプルをWebGLビルドして gh-page に展開する
This commit is contained in:
commit
3e31d3fc2b
47
.github/workflows/build-webgl.yml
vendored
47
.github/workflows/build-webgl.yml
vendored
|
|
@ -2,6 +2,9 @@ name: WebGL to gh-page
|
|||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# branches:
|
||||
# - workflow-webgl-wip
|
||||
|
||||
env:
|
||||
UNITY_PROJECT_PATH: .
|
||||
|
|
@ -53,17 +56,47 @@ jobs:
|
|||
echo "${UNITY_EDITOR_EXECUTABLE} is installed."
|
||||
echo "unity-editor-executable=${UNITY_EDITOR_EXECUTABLE}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Buidl WebGL
|
||||
id: build-webgl
|
||||
# URP
|
||||
- name: Build VRM10Viewer
|
||||
id: build-webgl-VRM10Viewer
|
||||
run: |
|
||||
# build to Build/SimpleViewer
|
||||
# build to Build/VRM10Viewer
|
||||
"${{ steps.detect-unity-version.outputs.unity-editor-executable }}" \
|
||||
-batchmode \
|
||||
-batchmode -quit \
|
||||
-silent-crashes \
|
||||
-projectPath "${{ env.UNITY_PROJECT_PATH }}" \
|
||||
-executeMethod "VRM.BuildClass.BuildWebGL_SimpleViewer" \
|
||||
-logFile create-webgl.log
|
||||
echo "Success to create BuildWebGL."
|
||||
-executeMethod "UniVRM10.DevOnly.BuildClass.BuildWebGL_VRM10Viewer" \
|
||||
-logFile webgl-VRM10Viewer.log
|
||||
echo "Success to WebGL VRM10Viewer."
|
||||
|
||||
# はじめに built-in RenderPipeline にして一度終わる。然るのちに
|
||||
- name: Build SimpleViewer
|
||||
id: build-webgl-SimpleViewer
|
||||
run: |
|
||||
"${{ steps.detect-unity-version.outputs.unity-editor-executable }}" \
|
||||
-batchmode -quit \
|
||||
-silent-crashes \
|
||||
-projectPath "${{ env.UNITY_PROJECT_PATH }}" \
|
||||
-executeMethod "VRM.DevOnly.BuildClass.SwitchBuiltinPipeline"
|
||||
echo "Success to Switch built-in RenderPipeline."
|
||||
|
||||
# build to Build/SimpleViewer
|
||||
"${{ steps.detect-unity-version.outputs.unity-editor-executable }}" \
|
||||
-batchmode -quit \
|
||||
-silent-crashes \
|
||||
-projectPath "${{ env.UNITY_PROJECT_PATH }}" \
|
||||
-executeMethod "VRM.DevOnly.BuildClass.BuildWebGL_SimpleViewer" \
|
||||
-logFile webgl-SimpleViewer.log
|
||||
echo "Success to WebGL SimpleViewer."
|
||||
|
||||
# make index
|
||||
cat << __HTML__ > Build/index.html
|
||||
<h2>$GITHUB_SHA</h2>
|
||||
<ul>
|
||||
<li>URP<a href="./VRM10Viewer/">VRM10Viewer</a></li>
|
||||
<li>Built-in<a href="./SimpleViewer/">SimpleViewer</a></li>
|
||||
</ul>
|
||||
__HTML__
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v2
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using UnityEditor;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.DevOnly
|
||||
{
|
||||
public static class BuildClass
|
||||
{
|
||||
|
|
@ -27,6 +26,11 @@ namespace VRM
|
|||
}
|
||||
}
|
||||
|
||||
public static void SwitchBuiltinPipeline()
|
||||
{
|
||||
UnityEngine.Rendering.GraphicsSettings.renderPipelineAsset = null;
|
||||
}
|
||||
|
||||
public static void BuildWebGL_SimpleViewer()
|
||||
{
|
||||
var scenes = new string[]{
|
||||
|
|
@ -46,25 +50,5 @@ namespace VRM
|
|||
throw new System.Exception(report.summary.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void BuildWebGL_VRM10Viewer()
|
||||
{
|
||||
var scenes = new string[]{
|
||||
"./Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity",
|
||||
};
|
||||
|
||||
var report = BuildPipeline.BuildPlayer(new BuildPlayerOptions
|
||||
{
|
||||
scenes = scenes,
|
||||
locationPathName = "Build/VRM10Viewer",
|
||||
target = BuildTarget.WebGL,
|
||||
}
|
||||
);
|
||||
|
||||
if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||
{
|
||||
throw new System.Exception(report.summary.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,13 +53,13 @@ namespace VRM
|
|||
private static void ShowVersionDialog() => VRMVersionMenu.ShowVersionDialog();
|
||||
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Build dummy for CI", false, 93)]
|
||||
private static void BuildDummyForCi() => BuildClass.Build();
|
||||
private static void BuildDummyForCi() => DevOnly.BuildClass.Build();
|
||||
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Build 0x WebGL for CI", false, 94)]
|
||||
private static void BuildWebGLForCi0x() => BuildClass.BuildWebGL_SimpleViewer();
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Switch to built-in RenderPipeline", false, 94)]
|
||||
private static void SwitchToBuiltinPipeline() => DevOnly.BuildClass.SwitchBuiltinPipeline();
|
||||
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Build 10 WebGL for CI", false, 95)]
|
||||
private static void BuildWebGLForCi10() => BuildClass.BuildWebGL_VRM10Viewer();
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Build WebGL SimpleViewer for CI", false, 95)]
|
||||
private static void BuildWebGLForCi0x() => DevOnly.BuildClass.BuildWebGL_SimpleViewer();
|
||||
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Create UnityPackage", false, 99)]
|
||||
private static void CreateUnityPackage() => VRMExportUnityPackage.CreateUnityPackageWithoutBuild();
|
||||
|
|
|
|||
27
Assets/VRM10/Editor/BuildClass.cs
Normal file
27
Assets/VRM10/Editor/BuildClass.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using UnityEditor;
|
||||
|
||||
namespace UniVRM10.DevOnly
|
||||
{
|
||||
public static class BuildClass
|
||||
{
|
||||
public static void BuildWebGL_VRM10Viewer()
|
||||
{
|
||||
var scenes = new string[]{
|
||||
"./Assets/VRM10_Samples/VRM10Viewer/VRM10Viewer.unity",
|
||||
};
|
||||
|
||||
var report = BuildPipeline.BuildPlayer(new BuildPlayerOptions
|
||||
{
|
||||
scenes = scenes,
|
||||
locationPathName = "Build/VRM10Viewer",
|
||||
target = BuildTarget.WebGL,
|
||||
}
|
||||
);
|
||||
|
||||
if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||
{
|
||||
throw new System.Exception(report.summary.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/VRM10/Editor/BuildClass.cs.meta
Normal file
11
Assets/VRM10/Editor/BuildClass.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3783cb4bfaca889418092d0fdde301ad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -26,6 +26,9 @@ namespace UniVRM10
|
|||
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Generate from JsonSchema(debug)", false, 101)]
|
||||
private static void Parse() => Vrm10SerializerGenerator.Run(true);
|
||||
|
||||
[MenuItem(DevelopmentMenuPrefix + "/Build WebGL VRM10Viewer for CI", false, 201)]
|
||||
private static void BuildWebGLForCi10() => DevOnly.BuildClass.BuildWebGL_VRM10Viewer();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user