mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Move docs to unity-ci.com
This commit is contained in:
parent
ec0cde0c85
commit
196fe8fc5b
405
README.md
405
README.md
@ -1,393 +1,50 @@
|
|||||||
# Unity - Builder
|
<div align="center">
|
||||||
|
<a href="https://github.com/marketplace/actions/unity-builder">
|
||||||
[](https://github.com/webbertakken/unity-builder/actions?query=branch%3Amaster+event%3Apush+workflow%3A%22Actions)
|
<img width="800" src="media/UnityBuilder-Logo.png" alt="Unity Builder">
|
||||||
[](https://lgtm.com/projects/g/webbertakken/unity-builder/context:javascript)
|
</a>
|
||||||
[](https://codecov.io/gh/webbertakken/unity-builder)
|
<br />
|
||||||
|
<br />
|
||||||
---
|
|
||||||
|
|
||||||
GitHub Action to
|
GitHub Action to
|
||||||
[build Unity projects](https://github.com/marketplace/actions/unity-builder)
|
[build Unity projects](https://github.com/marketplace/actions/unity-builder)
|
||||||
for different platforms.
|
for different platforms.
|
||||||
|
|
||||||
Part of the
|
Part of the <a href="https://unity-ci.com"><img height="30" src="media/UnityCI-ReferenceLogo.png" alt="Unity CI"></a> open source project.
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
<br />
|
||||||
collection.
|
<br />
|
||||||
|
|
||||||
---
|
[](https://github.com/webbertakken/unity-builder/actions?query=branch%3Amaster+event%3Apush+workflow%3A%22Actions)
|
||||||
|
[](https://lgtm.com/projects/g/webbertakken/unity-builder/context:javascript)
|
||||||
|
[](https://codecov.io/gh/webbertakken/unity-builder)
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
[Github Action](https://github.com/features/actions)
|
</div>
|
||||||
to build Unity projects for different platforms.
|
|
||||||
|
|
||||||
It is recommended to run the
|
## How to use
|
||||||
[Test](https://github.com/webbertakken/unity-actions#test)
|
|
||||||
action from the
|
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
|
||||||
collection before running this action. This action also requires the [Activation](https://github.com/marketplace/actions/unity-activate) step.
|
|
||||||
|
|
||||||
## Documentation
|
Find the
|
||||||
|
[docs](https://unity-ci.com/docs/github)
|
||||||
|
on the Unity CI
|
||||||
|
[website](https://unity-ci.com/).
|
||||||
|
|
||||||
See the
|
## Related actions
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
|
||||||
collection repository for workflow documentation and reference implementation.
|
|
||||||
|
|
||||||
## Usage
|
Visit the
|
||||||
|
<a href="https://github.com/webbertakken/unity-actions"><img height="30" src="media/UnityActions-ReferenceLogo.png" alt="Unity Actions"></a>
|
||||||
|
status repository for related Actions.
|
||||||
|
|
||||||
#### Setup builder
|
## Community
|
||||||
|
|
||||||
By default the enabled scenes from the project's settings will be built.
|
Feel free to join us on
|
||||||
|
<a href="http://unity-ci.com/discord"><img height="30" src="media/Discord-Logo.svg" alt="Discord" /></a>
|
||||||
|
and engage with the community.
|
||||||
|
|
||||||
Create or edit the file called `.github/workflows/main.yml` and add a job to it.
|
## Contributing
|
||||||
|
|
||||||
##### Personal License
|
To help out sharpen the documentation, please find the docs [repository](https://github.com/Unity-CI/Website).
|
||||||
|
|
||||||
Personal licenses require a one-time manual activation step (per unity version).
|
To contribute to Unity Builder, kindly read the [contribution guide](./CONTRIBUTING.md).
|
||||||
|
|
||||||
Make sure you
|
|
||||||
[acquire and activate](https://github.com/marketplace/actions/unity-request-activation-file)
|
|
||||||
your license file and add it as a secret.
|
|
||||||
|
|
||||||
Then, define the build step as follows:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
env:
|
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
with:
|
|
||||||
projectPath: path/to/your/project
|
|
||||||
unityVersion: 2020.X.XXXX
|
|
||||||
targetPlatform: WebGL
|
|
||||||
```
|
|
||||||
|
|
||||||
##### Professional license
|
|
||||||
|
|
||||||
Professional licenses do not need any manual steps.
|
|
||||||
|
|
||||||
Instead, three variables will need to be set.
|
|
||||||
|
|
||||||
- `UNITY_EMAIL` (should contain the email address for your Unity account)
|
|
||||||
- `UNITY_PASSWORD` (the password that you use to login to Unity)
|
|
||||||
- `UNITY_SERIAL` (the serial provided by Unity)
|
|
||||||
|
|
||||||
Define the build step as follows:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
env:
|
|
||||||
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
||||||
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
||||||
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
|
|
||||||
with:
|
|
||||||
projectPath: path/to/your/project
|
|
||||||
unityVersion: 2020.X.XXXX
|
|
||||||
targetPlatform: WebGL
|
|
||||||
```
|
|
||||||
|
|
||||||
That is all you need to build your project.
|
|
||||||
|
|
||||||
#### Storing the build
|
|
||||||
|
|
||||||
To be able to access your built files,
|
|
||||||
they need to be uploaded as artifacts.
|
|
||||||
To do this it is recommended to use Github Actions official
|
|
||||||
[upload artifact action](https://github.com/marketplace/actions/upload-artifact)
|
|
||||||
after any build action.
|
|
||||||
|
|
||||||
By default, Builder outputs it's builds to a folder named `build`.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: actions/upload-artifact@v1
|
|
||||||
with:
|
|
||||||
name: Build
|
|
||||||
path: build
|
|
||||||
```
|
|
||||||
|
|
||||||
Builds can now be downloaded as Artifacts in the Actions tab.
|
|
||||||
|
|
||||||
#### Caching
|
|
||||||
|
|
||||||
In order to make builds run faster, you can cache Library files from previous
|
|
||||||
builds. To do so simply add Github Actions official
|
|
||||||
[cache action](https://github.com/marketplace/actions/cache) before any unity steps.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: actions/cache@v1.1.0
|
|
||||||
with:
|
|
||||||
path: path/to/your/project/Library
|
|
||||||
key: Library-MyProjectName-TargetPlatform
|
|
||||||
restore-keys: |
|
|
||||||
Library-MyProjectName-
|
|
||||||
Library-
|
|
||||||
```
|
|
||||||
|
|
||||||
This simple addition could speed up your build by more than 50%.
|
|
||||||
|
|
||||||
## Complete example
|
|
||||||
|
|
||||||
A complete workflow that builds every available platform could look like this:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
name: Build project
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request: {}
|
|
||||||
push: { branches: [master] }
|
|
||||||
|
|
||||||
env:
|
|
||||||
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
buildForSomePlatforms:
|
|
||||||
name: Build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
projectPath:
|
|
||||||
- path/to/your/project
|
|
||||||
unityVersion:
|
|
||||||
- 2019.2.11f1
|
|
||||||
- 2019.3.0f1
|
|
||||||
targetPlatform:
|
|
||||||
- StandaloneOSX # Build a macOS standalone (Intel 64-bit).
|
|
||||||
- StandaloneWindows # Build a Windows standalone.
|
|
||||||
- StandaloneWindows64 # Build a Windows 64-bit standalone.
|
|
||||||
- StandaloneLinux64 # Build a Linux 64-bit standalone.
|
|
||||||
- iOS # Build an iOS player.
|
|
||||||
- Android # Build an Android .apk standalone app.
|
|
||||||
- WebGL # WebGL.
|
|
||||||
- WSAPlayer # Build an Windows Store Apps player.
|
|
||||||
- PS4 # Build a PS4 Standalone.
|
|
||||||
- XboxOne # Build a Xbox One Standalone.
|
|
||||||
- tvOS # Build to Apple's tvOS platform.
|
|
||||||
- Switch # Build a Nintendo Switch player.
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
lfs: true
|
|
||||||
- uses: actions/cache@v1.1.0
|
|
||||||
with:
|
|
||||||
path: ${{ matrix.projectPath }}/Library
|
|
||||||
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
|
||||||
restore-keys: |
|
|
||||||
Library-${{ matrix.projectPath }}-
|
|
||||||
Library-
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
projectPath: ${{ matrix.projectPath }}
|
|
||||||
unityVersion: ${{ matrix.unityVersion }}
|
|
||||||
targetPlatform: ${{ matrix.targetPlatform }}
|
|
||||||
- uses: actions/upload-artifact@v1
|
|
||||||
with:
|
|
||||||
name: Build
|
|
||||||
path: build
|
|
||||||
```
|
|
||||||
|
|
||||||
> **Note:** _Environment variables are set for all jobs in the workflow like this._
|
|
||||||
|
|
||||||
## Configuration options
|
|
||||||
|
|
||||||
Below options can be specified under `with:` for the `unity-builder` action.
|
|
||||||
|
|
||||||
#### projectPath
|
|
||||||
|
|
||||||
Specify the path to your Unity project to be built.
|
|
||||||
The path should be relative to the root of your project.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** `<your project root>`_
|
|
||||||
|
|
||||||
#### unityVersion
|
|
||||||
|
|
||||||
Version of Unity to use for building the project.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** `2019.2.1f11`_
|
|
||||||
|
|
||||||
#### targetPlatform
|
|
||||||
|
|
||||||
Platform that the build should target.
|
|
||||||
|
|
||||||
Must be one of the [allowed values](https://docs.unity3d.com/ScriptReference/BuildTarget.html) listed in the Unity scripting manual.
|
|
||||||
|
|
||||||
_**required:** `true`_
|
|
||||||
|
|
||||||
#### buildName
|
|
||||||
|
|
||||||
Name of the build. Also the folder in which the build will be stored within `buildsPath`.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** `<build_target>`_
|
|
||||||
|
|
||||||
#### buildsPath
|
|
||||||
|
|
||||||
Path where the builds should be stored.
|
|
||||||
|
|
||||||
In this folder a folder will be created for every targetPlatform.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** `build`_
|
|
||||||
|
|
||||||
#### buildMethod
|
|
||||||
|
|
||||||
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:**_
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
buildMethod: EditorNamespace.BuilderClassName.StaticBulidMethod
|
|
||||||
```
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** Built-in script that will run a build out of the box._
|
|
||||||
|
|
||||||
#### versioning
|
|
||||||
|
|
||||||
Configure a specific versioning strategy
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
versioning: Semantic
|
|
||||||
```
|
|
||||||
|
|
||||||
Find the available strategies below:
|
|
||||||
|
|
||||||
##### Semantic
|
|
||||||
|
|
||||||
Versioning out of the box! **(recommended)**
|
|
||||||
|
|
||||||
> Compatible with **all platforms**.
|
|
||||||
> Does **not** modify your repository.
|
|
||||||
> Requires **zero configuration**.
|
|
||||||
|
|
||||||
How it works:
|
|
||||||
|
|
||||||
> Generates a version based on [semantic versioning](https://semver.org/).
|
|
||||||
> Follows `<major>.<minor>.<patch>` for example `0.17.2`.
|
|
||||||
> The latest tag dictates `<major>.<minor>` (defaults to 0.0 for no tag).
|
|
||||||
> The number of commits (since the last tag, if any) is used for `<patch>`.
|
|
||||||
|
|
||||||
No configuration required.
|
|
||||||
|
|
||||||
##### Custom
|
|
||||||
|
|
||||||
Allows specifying a custom version in the `version` field. **(advanced users)**
|
|
||||||
|
|
||||||
> This strategy is useful when your project or pipeline has some kind of orchestration
|
|
||||||
> that determines the versions.
|
|
||||||
|
|
||||||
##### None
|
|
||||||
|
|
||||||
No version will be set by Builder. **(not recommended)**
|
|
||||||
|
|
||||||
> Not recommended unless you generate a new version in a pre-commit hook. Manually
|
|
||||||
> setting versions is error-prone.
|
|
||||||
|
|
||||||
#### androidVersionCode
|
|
||||||
|
|
||||||
Configure the android `versionCode`.
|
|
||||||
|
|
||||||
When not specified, the version code is generated from the version using the `major * 1000000 + minor * 1000 + patch` scheme;
|
|
||||||
|
|
||||||
#### androidAppBundle
|
|
||||||
|
|
||||||
Set this flag to `true` to build '.aab' instead of '.apk'.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** `false`_
|
|
||||||
|
|
||||||
#### androidKeystoreName
|
|
||||||
|
|
||||||
Configure the android `keystoreName`.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** ""_
|
|
||||||
|
|
||||||
#### androidKeystoreBase64
|
|
||||||
|
|
||||||
Configure the base64 contents of the android keystore file.
|
|
||||||
|
|
||||||
The contents will be decoded from base64 with `echo $androidKeystoreBase64 | base64 --decode > $androidKeystoreName`;
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** ""_
|
|
||||||
|
|
||||||
#### androidKeystorePass
|
|
||||||
|
|
||||||
Configure the android `keystorePass`.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** ""_
|
|
||||||
|
|
||||||
#### androidKeyaliasName
|
|
||||||
|
|
||||||
Configure the android `keyaliasName`.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** ""_
|
|
||||||
|
|
||||||
#### androidKeyaliasPass
|
|
||||||
|
|
||||||
Configure the android `keyaliasPass`.
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** ""_
|
|
||||||
|
|
||||||
#### allowDirtyBuild
|
|
||||||
|
|
||||||
Allows the branch of the build to be dirty, and still generate the build.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
allowDirtyBuild: true
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that it is generally bad practice to modify your branch
|
|
||||||
in a CI Pipeline. However there are exceptions where this might
|
|
||||||
be needed. (use with care).
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** false_
|
|
||||||
|
|
||||||
#### customParameters
|
|
||||||
|
|
||||||
Custom parameters to configure the build.
|
|
||||||
|
|
||||||
Parameters must start with a hyphen (`-`) and may be followed by a value (without hyphen).
|
|
||||||
|
|
||||||
Parameters without a value will be considered booleans (with a value of true).
|
|
||||||
|
|
||||||
_**example:**_
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: webbertakken/unity-builder@<version>
|
|
||||||
with:
|
|
||||||
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
|
||||||
```
|
|
||||||
|
|
||||||
_**required:** `false`_
|
|
||||||
_**default:** ""_
|
|
||||||
|
|
||||||
## More actions
|
|
||||||
|
|
||||||
Visit
|
|
||||||
[Unity Actions](https://github.com/webbertakken/unity-actions)
|
|
||||||
to find related actions for Unity.
|
|
||||||
|
|
||||||
Feel free to contribute.
|
|
||||||
|
|
||||||
## Licence
|
## Licence
|
||||||
|
|
||||||
|
1
media/Discord-Logo.svg
Normal file
1
media/Discord-Logo.svg
Normal file
@ -0,0 +1 @@
|
|||||||
|
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 272.1"><style>.st0{fill:#7289DA;}</style><path class="st0" d="M142.8 120.1c-5.7 0-10.2 4.9-10.2 11s4.6 11 10.2 11c5.7 0 10.2-4.9 10.2-11s-4.6-11-10.2-11zM106.3 120.1c-5.7 0-10.2 4.9-10.2 11s4.6 11 10.2 11c5.7 0 10.2-4.9 10.2-11 .1-6.1-4.5-11-10.2-11z"/><path class="st0" d="M191.4 36.9h-134c-11.3 0-20.5 9.2-20.5 20.5v134c0 11.3 9.2 20.5 20.5 20.5h113.4l-5.3-18.3 12.8 11.8 12.1 11.1 21.6 18.7V57.4c-.1-11.3-9.3-20.5-20.6-20.5zm-38.6 129.5s-3.6-4.3-6.6-8c13.1-3.7 18.1-11.8 18.1-11.8-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.4-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.6-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.2-1.8-1-2.8-1.7-2.8-1.7s4.8 7.9 17.5 11.7c-3 3.8-6.7 8.2-6.7 8.2-22.1-.7-30.5-15.1-30.5-15.1 0-31.9 14.4-57.8 14.4-57.8 14.4-10.7 28-10.4 28-10.4l1 1.2c-18 5.1-26.2 13-26.2 13s2.2-1.2 5.9-2.8c10.7-4.7 19.2-5.9 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.5 0 0-7.9-7.5-24.9-12.6l1.4-1.6s13.7-.3 28 10.4c0 0 14.4 25.9 14.4 57.8 0-.1-8.4 14.3-30.5 15zM303.8 79.7h-33.2V117l22.1 19.9v-36.2h11.8c7.5 0 11.2 3.6 11.2 9.4v27.7c0 5.8-3.5 9.7-11.2 9.7h-34v21.1h33.2c17.8.1 34.5-8.8 34.5-29.2v-29.8c.1-20.8-16.6-29.9-34.4-29.9zm174 59.7v-30.6c0-11 19.8-13.5 25.8-2.5l18.3-7.4c-7.2-15.8-20.3-20.4-31.2-20.4-17.8 0-35.4 10.3-35.4 30.3v30.6c0 20.2 17.6 30.3 35 30.3 11.2 0 24.6-5.5 32-19.9l-19.6-9c-4.8 12.3-24.9 9.3-24.9-1.4zM417.3 113c-6.9-1.5-11.5-4-11.8-8.3.4-10.3 16.3-10.7 25.6-.8l14.7-11.3c-9.2-11.2-19.6-14.2-30.3-14.2-16.3 0-32.1 9.2-32.1 26.6 0 16.9 13 26 27.3 28.2 7.3 1 15.4 3.9 15.2 8.9-.6 9.5-20.2 9-29.1-1.8l-14.2 13.3c8.3 10.7 19.6 16.1 30.2 16.1 16.3 0 34.4-9.4 35.1-26.6 1-21.7-14.8-27.2-30.6-30.1zm-67 55.5h22.4V79.7h-22.4v88.8zM728 79.7h-33.2V117l22.1 19.9v-36.2h11.8c7.5 0 11.2 3.6 11.2 9.4v27.7c0 5.8-3.5 9.7-11.2 9.7h-34v21.1H728c17.8.1 34.5-8.8 34.5-29.2v-29.8c0-20.8-16.7-29.9-34.5-29.9zm-162.9-1.2c-18.4 0-36.7 10-36.7 30.5v30.3c0 20.3 18.4 30.5 36.9 30.5 18.4 0 36.7-10.2 36.7-30.5V109c0-20.4-18.5-30.5-36.9-30.5zm14.4 60.8c0 6.4-7.2 9.7-14.3 9.7-7.2 0-14.4-3.1-14.4-9.7V109c0-6.5 7-10 14-10 7.3 0 14.7 3.1 14.7 10v30.3zM682.4 109c-.5-20.8-14.7-29.2-33-29.2h-35.5v88.8h22.7v-28.2h4l20.6 28.2h28L665 138.1c10.7-3.4 17.4-12.7 17.4-29.1zm-32.6 12h-13.2v-20.3h13.2c14.1 0 14.1 20.3 0 20.3z"/></svg>
|
After Width: | Height: | Size: 2.3 KiB |
BIN
media/UnityActions-ReferenceLogo.png
Normal file
BIN
media/UnityActions-ReferenceLogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
BIN
media/UnityBuilder-Logo.png
Normal file
BIN
media/UnityBuilder-Logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
BIN
media/UnityCI-ReferenceLogo.png
Normal file
BIN
media/UnityCI-ReferenceLogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
Loading…
Reference in New Issue
Block a user