UnityCI

Only unity pro can use commandline to build, otherwise will get Failed to activate/update license problem

Setting CI/CD for a Unity Project in GitHub Actions

tested in 2018.4.10f1

  1. run docker image

docker run -it gableroux/unity3d:X.X.X

  1. in docker create activation file

./Unity -quit -batchmode -nographics -logFile -createManualActivationFile

参数 说明
quit 执行完后结束
batchmode 只在commandline 执行
nographics 没有图像输出
logFile 结果输出到console
createManualActivationFile 创建 activation file 包含license
  1. cat Unity_v2018.2.21f1.alf
  2. copy paste content to local file
  3. active this version in unity with alf file
  4. encrypt this file with openssl aes-256-cbc -e -in "D:\Shared Projects\Unity\UnityCI\Unity_v2017.x.ulf" -out "D:\Shared Projects\Unity\UnityCI\Unity_v2017.x.ulf.enc" -k wTnz@rW7Ru9@^JhEcYSC-P#=fzNX4%d2
  5. set GitHub settings secret key
  6. add .github folder in project, put encrypt file in it
  7. create workflows folder in it
  8. add yml configuration file in it
  9. push to github

using another way

  1. copy BuildScript.cs in Assets/Scripts/Editor, this script is used to build unity project

  2. copy ci file .trvais.yml

  3. copy ci folder