Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Initial Release! 🎉🚀
  • Loading branch information
StephenHodgson authored Aug 12, 2024
1 parent b49df65 commit 9bedef8
Show file tree
Hide file tree
Showing 16 changed files with 29,027 additions and 2 deletions.
Empty file added .github/CODEOWNERS
Empty file.
88 changes: 88 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: validate
on:
schedule:
- cron: '0 0 * * 0' # Every Sunday at midnight
push:
branches:
- 'main'
pull_request:
branches:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
timeout-minutes: 60
env:
TEMPLATE_PATH: ''
UNITY_EDITOR_PATH: '' # set from unity-setup step
UNITY_PROJECT_PATH: '' # set from unity-setup step
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
unity-version:
- 2019.4.40f1 (ffc62b691db5)
- 2020.3.48f1 (b805b124c6b7)
- 2021.3.41f1 (6c5a9e20c022)
- 2022.3.40f1 (cbdda657d2f0)
- 6000.0.13f1 (53a692e3fca9)
include: # for each os specify the build targets
- os: ubuntu-latest
build-target: StandaloneLinux64
- os: windows-latest
build-target: StandaloneWindows64
- os: macos-13
build-target: StandaloneOSX
steps:
- uses: actions/checkout@v4
- run: 'npm install -g openupm-cli'
# Installs the Unity Editor based on your project version text file
# sets -> env.UNITY_EDITOR_PATH
# sets -> env.UNITY_PROJECT_PATH
- uses: buildalon/unity-setup@v1
with:
version-file: 'None'
build-targets: ${{ matrix.build-target }}
unity-version: ${{ matrix.unity-version }}
- name: Find Unity Template Path
run: |
$rootPath = $env:UNITY_EDITOR_PATH -replace "Editor.*", ""
Write-Host "ROOT_PATH=$rootPath"
$templatePath = Get-ChildItem -Recurse -Filter "com.unity.template.3d*.tgz" -Path $rootPath | Select-Object -First 1 | Select-Object -ExpandProperty FullName
Write-Host "TEMPLATE_PATH=$templatePath"
echo "TEMPLATE_PATH=$templatePath" >> $env:GITHUB_ENV
shell: pwsh
# Activates the installation with the provided credentials
- uses: buildalon/activate-unity-license@v1
with:
license: 'Personal'
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
- uses: ./ # buildalon/unity-action
name: Create Test Project
with:
log-name: 'create-test-project'
args: '-quit -nographics -batchmode -createProject "${{ github.workspace }}/TestProject" -cloneFromTemplate "${{ env.TEMPLATE_PATH }}"'
- run: 'openupm add com.utilities.buildpipeline'
name: Add Build Pipeline Package
working-directory: ${{ github.workspace }}/TestProject
- uses: ./ # buildalon/unity-action
name: '${{ matrix.build-target }}-Build'
with:
project-path: ${{ github.workspace }}/TestProject
log-name: '${{ matrix.build-target }}-Build'
build-target: '${{ matrix.build-target }}'
args: '-quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity'
- uses: actions/upload-artifact@v4
name: Upload Artifacts
if: always()
with:
name: '${{ github.run_number }}.${{ github.run_attempt }}-${{ runner.os }}-${{ matrix.build-target }}-${{ matrix.unity-version }}-Artifacts'
path: |
${{ github.workspace }}/**/*.log
${{ github.workspace }}/**/Builds/${{ matrix.build-target }}/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# unity-action
A Github Action to execute Unity Editor command line arguments.
# Buildalon Unity Action

[![Discord](https://img.shields.io/discord/939721153688264824.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/VM9cWJ9rjH) [![validate](https://github.com/buildalon/unity-action/actions/workflows/validate.yml/badge.svg?branch=main&event=push)](https://github.com/buildalon/unity-action/actions/workflows/validate.yml)

A Github Action to execute [Unity Editor command line arguments](https://docs.unity3d.com/Manual/EditorCommandLineArguments.html).

## How to use

### Workflow

```yaml
jobs:
build:
env:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
build-target: StandaloneLinux64
- os: windows-latest
build-target: StandaloneWindows64
- os: macos-13
build-target: StandaloneOSX
steps:
- uses: buildalon/unity-action@v1
name: '${{ matrix.build-target }}-Build'
with:
editor-path: 'path/to/your/unity/editor/installation'
project-path: 'path/to/your/unity/project'
log-name: '${{ matrix.build-target }}-Build'
build-target: '${{ matrix.build-target }}'
args: '-quit -nographics -batchmode'
```
### Inputs
| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `editor-path` | The path to the unity editor installation you want to use to execute the arguments with. | If `UNITY_EDITOR_PATH` environment variable is not set. | `env.UNITY_EDITOR_PATH` |
| `project-path` | The path to the unity project you want to use when executing arguments. | If `UNITY_PROJECT_PATH` environment variable is not set, or if it isn't required for the command. | `env.UNITY_PROJECT_PATH` |
| `build-target` | The build target to use when executing arguments. | false | |
| `args` | The [arguments](https://docs.unity3d.com/Manual/EditorCommandLineArguments.html) to use when executing commands to the editor. | true | `-quit -batchmode -nographics` |
| `log-name` | The name of the log file to create when running the commands. | false | `Unity-yyyyMMddTHHmmss` |
27 changes: 27 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Buildalon Unity Action
description: A Github Action to execute Unity Editor command line arguments.
branding:
icon: 'cpu'
color: 'red'
inputs:
editor-path:
description: 'Path to the Unity Editor. If not provided, the action will use the environment variable UNITY_EDITOR_PATH.'
required: false
project-path:
description: 'Path to the Unity project. If not provided, the action will use the environment variable UNITY_PROJECT_PATH.'
required: false
build-target:
description: 'Unity build target.'
required: false
default: ''
args:
description: 'Unity Editor cli arguments.'
required: false
default: '-quit -batchmode -nographics'
log-name:
description: 'Name of the Unity log file.'
required: false
default: 'Unity'
runs:
using: 'node20'
main: 'dist/index.js'
Loading

0 comments on commit 9bedef8

Please sign in to comment.