unity-builder/README.md

146 lines
3.5 KiB
Markdown
Raw Normal View History

2019-11-30 18:02:18 +00:00
# Unity - Builder
2019-12-22 21:06:34 +00:00
2019-11-30 18:02:18 +00:00
[![Actions status](https://github.com/webbertakken/unity-builder/workflows/Actions%20%F0%9F%98%8E/badge.svg)](https://github.com/webbertakken/unity-builder/actions?query=branch%3Amaster+workflow%3A%22Actions+%F0%9F%98%8E%22)
2019-12-03 22:16:18 +00:00
---
2019-12-22 21:06:34 +00:00
GitHub Action to
[build Unity projects](https://github.com/marketplace/actions/unity-builder)
2019-12-03 22:16:18 +00:00
for different platforms.
2019-12-22 21:06:34 +00:00
Part of the
[Unity Actions](https://github.com/webbertakken/unity-actions)
2019-12-03 22:16:18 +00:00
collection.
---
2019-11-30 18:02:18 +00:00
[Github Action](https://github.com/features/actions)
to build Unity projects for different platforms.
It is recommended to run the
[Test](https://github.com/webbertakken/unity-actions#test)
2019-12-22 21:06:34 +00:00
action from the
[Unity Actions](https://github.com/webbertakken/unity-actions)
2019-11-30 18:02:18 +00:00
collection before running this action. This action also requires the [Activation](https://github.com/marketplace/actions/unity-activate) step.
2019-12-01 01:03:52 +00:00
## Documentation
2019-12-22 21:06:34 +00:00
See the
2019-12-01 01:03:52 +00:00
[Unity Actions](https://github.com/webbertakken/unity-actions)
collection repository for workflow documentation and reference implementation.
## Usage
Create or edit the file called `.github/workflows/main.yml` and add a job to it.
```yaml
name: Build project
on: [push]
jobs:
2019-12-22 21:06:34 +00:00
buildForSomePlatforms:
name: Build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
2019-12-01 01:03:52 +00:00
runs-on: ubuntu-latest
2019-12-22 21:06:34 +00:00
strategy:
fail-fast: false
matrix:
projectPath:
- path/to/your/project
unityVersion:
- 2019.2.11f1
targetPlatform:
- WebGL
- iOS
2019-12-01 01:03:52 +00:00
steps:
2019-12-22 21:06:34 +00:00
- uses: actions/checkout@v1
- uses: webbertakken/unity-activate@v1
- uses: webbertakken/unity-builder@v0.3
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
- uses: webbertakken/unity-return-license@v1
if: always()
- uses: actions/upload-artifact@v1
with:
name: Build
path: build
2019-12-01 01:03:52 +00:00
```
2019-12-22 21:06:34 +00:00
> **Notes:**
>
> - Don't forget to replace _<test-project>_ with your project name.
> - By default the enabled scenes from the project's settings will be built.
2019-12-07 23:59:14 +00:00
2019-12-22 21:06:34 +00:00
## Configuration options
2019-12-01 01:03:52 +00:00
2019-12-22 21:06:34 +00:00
Below options can be specified under `with:` for the `unity-builder` action.
2019-12-01 01:03:52 +00:00
2019-12-22 21:06:34 +00:00
#### projectPath
2019-12-01 01:03:52 +00:00
2019-12-22 21:06:34 +00:00
Specify the path to your Unity project to be built.
The path should be relative to the root of your project.
2019-12-01 01:03:52 +00:00
2019-12-22 21:06:34 +00:00
_**required:** `false`_
_**default:** `<your project root>`_
2019-12-01 01:03:52 +00:00
2019-12-22 21:06:34 +00:00
#### unityVersion
Version of Unity to use for building the project.
_**required:** `false`_
_**default:** `2019.2.1f11`_
#### targetPlatform
Platform that the build should target.
_**required:** `true`_
#### buildName
2019-12-01 01:03:52 +00:00
2019-12-22 21:06:34 +00:00
Name of the build.
2019-12-07 23:59:14 +00:00
2019-12-22 21:06:34 +00:00
_**required:** `false`_
_**default:** `testBuild`_
#### buildsPath
Path where the builds should be stored.
In this folder a folder will be created for every targetPlatform.
_**required:** `false`_
_**default:** `build`_
#### buildCommand
Custom command to run your build.
There are two conditions for a custom buildCommand:
- Must reference a valid path to a `static` method.
- The class must reside in the `Assets/Editor` directory.
_**example:**_
2019-12-01 01:03:52 +00:00
```yaml
2019-12-22 21:06:34 +00:00
- uses: webbertakken/unity-builder@master
with:
buildCommand: EditorNamespace.BuilderClassName.StaticBulidMethod
2019-12-01 01:03:52 +00:00
```
2019-12-22 21:06:34 +00:00
_**required:** `false`_
_**default:** Built-in script that will run a build out of the box._
2019-12-01 01:03:52 +00:00
## More actions
2019-12-22 21:06:34 +00:00
Visit
[Unity Actions](https://github.com/webbertakken/unity-actions)
2019-12-01 01:03:52 +00:00
to find related actions for Unity.
Feel free to contribute.
2019-12-22 21:06:34 +00:00
## Licence
[MIT](./LICENSE)