Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: android build
on:
- push
jobs:
build:
name: build android apps
runs-on: ubuntu-latest
container: unityci/editor:ubuntu-2020.3.36f1-android-1
steps:
- name: checkout
uses: actions/checkout@v2

- name: activate unity license
run: ./ci/android/activate
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}

- name: export android project
run: ./ci/android/export

- name: install gradle
run: ./ci/android/install-gradle

- name: create aab
run: ./ci/android/package
env:
# https://github.com/masakura2/unity-ci-demo/actions/runs/3335939692/jobs/5520492479
# ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
# なんでやろう...
JAVA_HOME: /opt/unity/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK

- name: artifact
uses: actions/upload-artifact@v3
with:
name: android-project
path: build/android/launcher/build/outputs
13 changes: 13 additions & 0 deletions .idea/.idea.CI demo/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.CI demo/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.CI demo/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.CI demo/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Assets/Editor/Export.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using UnityEditor;

// ReSharper disable once CheckNamespace
// ReSharper disable once UnusedType.Global
public static class Export
{
// ReSharper disable once UnusedMember.Global
public static void Android()
{
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;

BuildPipeline.BuildPlayer(EditorBuildSettings.scenes,
"build/android",
BuildTarget.Android,
BuildOptions.None);
}
}
11 changes: 11 additions & 0 deletions Assets/Editor/Export.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

94 changes: 93 additions & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,99 @@ PlayerSettings:
AndroidValidateAppBundleSize: 1
AndroidAppBundleSizeToValidate: 150
m_BuildTargetIcons: []
m_BuildTargetPlatformIcons: []
m_BuildTargetPlatformIcons:
- m_BuildTarget: Android
m_Icons:
- m_Textures: []
m_Width: 432
m_Height: 432
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 324
m_Height: 324
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 216
m_Height: 216
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 162
m_Height: 162
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 108
m_Height: 108
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 81
m_Height: 81
m_Kind: 2
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 0
m_SubKind:
- m_Textures: []
m_Width: 192
m_Height: 192
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 144
m_Height: 144
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 96
m_Height: 96
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 72
m_Height: 72
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 48
m_Height: 48
m_Kind: 1
m_SubKind:
- m_Textures: []
m_Width: 36
m_Height: 36
m_Kind: 1
m_SubKind:
m_BuildTargetBatching: []
m_BuildTargetGraphicsJobs:
- m_BuildTarget: MacStandaloneSupport
Expand Down
6 changes: 6 additions & 0 deletions ci/android/activate
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -eux

echo "$UNITY_LICENSE" > UnityLicenseFile.ulf
unity-editor -logFile - -quit -manualLicenseFile UnityLicenseFile.ulf || true
5 changes: 5 additions & 0 deletions ci/android/export
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -eux

unity-editor -batchmode -quit -logFile - -projectPath . -executeMethod Export.Android
8 changes: 8 additions & 0 deletions ci/android/install-gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

apt-get -qy update && apt-get -qy install unzip || true

cd build/android
mkdir -p gradle
wget https://services.gradle.org/distributions/gradle-6.9.3-bin.zip
unzip -d gradle gradle-6.9.3-bin.zip
4 changes: 4 additions & 0 deletions ci/android/package
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cd build/android
./gradle/gradle-6.9.3/bin/gradle launcher:bundleRelease