Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
unity-build: w3d/unity-build@0.0.7
Use unity-build
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
Job That Builds a Unity Project.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
exec | - | Yes | - | executor |
android_build | - | No | true | boolean |
app_version | App Version | Yes | - | string |
app_name | App Name | Yes | - | string |
unity_build_method | Unity Build Method to Execute | Yes | - | string |
unity_bundleversioncode | Unity bundleVersionCode | Yes | - | string |
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
fastlane_lane | Fastlane Lane to Run | Yes | - | string |
exec | - | Yes | - | executor |
Build Unity Project
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
unity_build_method | - | Yes | - | string |
unity_appversion | - | Yes | - | string |
unity_bundleversioncode | - | Yes | - | string |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/ja/orbs/licensing
version: "2.1"
description: "Unity Build Orb"
commands:
unity-build:
description: "Build Unity Project"
parameters:
unity_build_method:
type: string
unity_appversion:
type: string
unity_bundleversioncode:
type: string
steps:
- run:
name: Building Unity Project
command: xvfb-run -a /opt/Unity/Editor/Unity -quit -nographics -batchmode -logfile /root/project/UnityBuildLog.log -projectPath /root/project/ -executeMethod << parameters.unity_build_method >> -appVersion << parameters.unity_appversion >> -bundleVersionCode << parameters.unity_bundleversioncode >> -serial $UNITY_SERIAL -username $UNITY_USERNAME -password $UNITY_PASSWORD
no_output_timeout: 60m
store-unity-build-log:
description: "Store Unity Build Log Artifact"
steps:
- store_artifacts:
path: /root/project/UnityBuildLog.log
destination: UnityBuildLog.log
store-artifacts:
description: "Store Artifacts"
steps:
- store_artifacts:
path: Build/
jobs:
build-unity:
description: Job That Builds a Unity Project.
parameters:
exec:
type: executor
android_build:
type: boolean
default: true
app_version:
description: "App Version"
type: string
app_name:
description: "App Name"
type: string
unity_build_method:
description: "Unity Build Method to Execute"
type: string
unity_bundleversioncode:
description: "Unity bundleVersionCode"
type: string
executor: << parameters.exec >>
steps:
- checkout
- run:
name: Install Git LFS
command: |
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash
apt-get update
apt-get install -y git-lfs openssh-client
git lfs install
mkdir -p ~/.ssh
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
ssh git@github.com git-lfs-authenticate "${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" download
- run:
name: "Git LFS Pull"
command: "git lfs pull"
- unity-build:
unity_build_method: << parameters.unity_build_method >>
unity_appversion: << parameters.app_version >>
unity_bundleversioncode: << parameters.unity_bundleversioncode >>
- store-unity-build-log
- when:
condition: << parameters.android_build >>
steps:
- run: mv Build/Android/build_android.apk Build/Android/<< parameters.app_name >>_<< parameters.app_version >>.apk
- run:
name: Store Persistent Environment Variables
command: echo "export W3D_APK_PATH=Build/Android/<< parameters.app_name >>_<< parameters.app_version >>.apk" >> Build/persistent_env_vars
- store-artifacts
- persist_to_workspace:
root: Build
paths:
- iOS
- Android
- persistent_env_vars
fastlane:
parameters:
fastlane_lane:
description: Fastlane Lane to Run
type: string
exec:
type: executor
executor: << parameters.exec >>
shell: /bin/bash --login -o pipefail
steps:
- checkout
- attach_workspace:
at: Build
- run:
name: Source Persistent Environment Variables
command: source ./Build/persistent_env_vars && echo $W3D_APK_PATH
- run:
name: "Configure Bundler"
command: |
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV
source $BASH_ENV
sudo gem install bundler
- run:
name: "Bundle Install"
command: bundle install
- run:
name: "Run Fastlane"
command: source ./Build/persistent_env_vars && bundle exec fastlane << parameters.fastlane_lane >>
no_output_timeout: 20m
- store-artifacts