Travis Ci scripts to push changes to specific branch for using with Unity Package Manager (UPM) system
There's Packages/manifest.json
in your Unity project folder. You can manually add git
dependencies in it like this
"com.company.repo.name": "https://YourGitHost.com/UserName/RepoName.git#BranchName"
To update asset through UPM you must delete reference in lock
section in manifest.
Currently you must follow strict rules if you want to use your asset like this. Most importantly, aux files (manifest, asmdef) must be in repo root and have *.meta
files.
This repo will help you set up CI for separate UPM branch
- Register at https://travis-ci.org/ for public or at https://travis-ci.com/ for private repos
- Open repo settings, go to
Environment Variables
- Add variable with exact name
GITHUB_TOKEN
and value from created token with selected scoperepo
- Open your project in Unity
- Create
package.json
near your main folder (but insideAssets
!) with keywords and category of your choice:{ "name": "com.company.repo.name", "displayName": "Display Name of Your Asset", "version": "0.1.1", "unity": "2018.3", "description": "Short description of your asset", "keywords": [ "unity", "editor" ], "category": "Instrument" }
- Create Assembly definition file
com.company.repo.name.asmdef
in the same folder:If you have Editor folders, repeat for each:{ "name": "Display Name of Your Asset" }
- Create Assembly definition files with only
editor
platform included - Add references to other necessary asmdefs
- Create Assembly definition files with only
- Make sure that
*.meta
files appeared. You now must have 6 items in your dir: 1 folder, 1 .json, 1 .asmdef and 3 .meta - Copy
.travis.yml
file andci
folder to project's root - Edit
.travis.yml
, change env variables - target branches and folder to export. If you want to test this config, add custom test branch tobranches: only:
section - Commit and push changes
- If your commit doesn't require CI (like readme editing) you can add
[skip ci]
into your commit message and Travis won't build it - Unity is not consistent while handling Editor folders in packages during build, so it's mandatory to wrap all editor scripts in
#IF UNITY_EDITOR ... #ENDIF
or make new asmdef file in every Editor folder with onlyEditor
checked in platforms