Skip to content

Commit ea6dbe1

Browse files
create-unity-project@v2.0.0 (#4)
- Refactored into TypeScript action that uses unity-cli@v1.4.3
1 parent 9359c73 commit ea6dbe1

16 files changed

+63811
-76
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"os": [
3+
"ubuntu-latest",
4+
"windows-latest",
5+
"macos-latest"
6+
],
7+
"unity-version": [
8+
"2019",
9+
"2020",
10+
"2022",
11+
"6000.0",
12+
"6000.1",
13+
"6000.2"
14+
],
15+
"include": [
16+
{
17+
"os": "ubuntu-latest",
18+
"build-target": "StandaloneLinux64"
19+
},
20+
{
21+
"os": "ubuntu-latest",
22+
"build-target": "WebGL",
23+
"build-args": "-colorSpace Gamma"
24+
},
25+
{
26+
"os": "ubuntu-latest",
27+
"build-target": "Android"
28+
},
29+
{
30+
"os": "windows-latest",
31+
"build-target": "StandaloneWindows64"
32+
},
33+
{
34+
"os": "windows-latest",
35+
"build-target": "Android"
36+
},
37+
{
38+
"os": "macos-latest",
39+
"build-target": "StandaloneOSX"
40+
},
41+
{
42+
"os": "macos-latest",
43+
"build-target": "iOS"
44+
}
45+
]
46+
}

.github/workflows/build.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: build
2+
permissions:
3+
contents: read
4+
on:
5+
workflow_call:
6+
inputs:
7+
matrix:
8+
required: true
9+
type: string
10+
secrets:
11+
UNITY_USERNAME:
12+
required: true
13+
UNITY_PASSWORD:
14+
required: true
15+
jobs:
16+
build:
17+
name: ${{ matrix.name }}
18+
strategy:
19+
matrix: ${{ fromJSON(inputs.matrix) }}
20+
fail-fast: false
21+
runs-on: ${{ matrix.os }}
22+
permissions:
23+
contents: read
24+
steps:
25+
- name: Free Disk Space
26+
if: ${{ matrix.os == 'ubuntu-latest' && matrix.unity-version == '6000.2' }}
27+
uses: endersonmenezes/free-disk-space@713d134e243b926eba4a5cce0cf608bfd1efb89a # v2.1.1
28+
with:
29+
remove_android: true
30+
remove_dotnet: false
31+
- uses: actions/checkout@v5
32+
- uses: RageAgainstThePixel/unity-setup@v2
33+
with:
34+
version-file: None
35+
build-targets: ${{ matrix.build-target }}
36+
unity-version: ${{ matrix.unity-version }}
37+
- uses: RageAgainstThePixel/activate-unity-license@v2
38+
with:
39+
license: Personal
40+
username: ${{ secrets.UNITY_USERNAME }}
41+
password: ${{ secrets.UNITY_PASSWORD }}
42+
- uses: ./ #RageAgainstThePixel/create-unity-project
43+
id: unity-project
44+
with:
45+
project-name: Test Project
46+
- name: Add Build Pipeline Package
47+
run: |
48+
npm install -g openupm-cli
49+
openupm add com.utilities.buildpipeline
50+
working-directory: ${{ steps.unity-project.outputs.project-path }}
51+
shell: bash
52+
- uses: RageAgainstThePixel/unity-action@v3
53+
name: ${{ matrix.build-target }}-Validate
54+
with:
55+
build-target: ${{ matrix.build-target }}
56+
project-path: ${{ steps.unity-project.outputs.project-path }}
57+
log-name: ${{ matrix.build-target }}-Validate
58+
args: -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject -importTMProEssentialsAsset
59+
- uses: RageAgainstThePixel/unity-action@v3
60+
name: ${{ matrix.build-target }}-Build
61+
with:
62+
build-target: ${{ matrix.build-target }}
63+
project-path: ${{ steps.unity-project.outputs.project-path }}
64+
log-name: ${{ matrix.build-target }}-Build
65+
args: -quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Scenes/SampleScene.unity ${{ matrix.build-args }}
66+
- uses: actions/upload-artifact@v4
67+
name: Upload Artifacts
68+
if: always()
69+
with:
70+
name: ${{ github.run_number }}.${{ github.run_attempt }} ${{ matrix.os }} ${{ matrix.unity-version }} ${{ matrix.build-target }} Artifacts
71+
path: |
72+
${{ github.workspace }}/**/*.log
73+
${{ github.workspace }}/**/Builds/${{ matrix.build-target }}/

.github/workflows/update-release-tags.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
permissions:
1010
contents: write
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v5
1313
with:
1414
fetch-depth: 0
1515
- uses: RageAgainstThePixel/update-action-release-tags@v1

.github/workflows/validate.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: validate
2+
on:
3+
schedule:
4+
- cron: '0 0 * * 0' # Every Sunday at midnight
5+
push:
6+
branches: ['main']
7+
pull_request:
8+
branches: ['*']
9+
types: [opened, synchronize, reopened, ready_for_review]
10+
workflow_dispatch:
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
jobs:
15+
setup:
16+
if: github.event.pull_request.draft == false
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
steps:
21+
- uses: actions/checkout@v5
22+
with:
23+
sparse-checkout: .github/
24+
- uses: RageAgainstThePixel/job-builder@v1
25+
id: setup-jobs
26+
with:
27+
build-options: ./.github/workflows/build-options.json
28+
group-by: 'unity-version'
29+
outputs:
30+
jobs: ${{ steps.setup-jobs.outputs.jobs }}
31+
validate:
32+
if: ${{ needs.setup.outputs.jobs }}
33+
needs: setup
34+
name: build ${{ matrix.jobs.name }}
35+
permissions:
36+
contents: read
37+
strategy:
38+
matrix: ${{ fromJSON(needs.setup.outputs.jobs) }}
39+
fail-fast: false
40+
max-parallel: 1
41+
secrets: inherit
42+
uses: ./.github/workflows/build.yml
43+
with:
44+
matrix: ${{ toJSON(matrix.jobs.matrix) }}
45+
timeline:
46+
needs: [setup, validate]
47+
if: always()
48+
runs-on: ubuntu-latest
49+
permissions:
50+
contents: read
51+
steps:
52+
- uses: Kesin11/actions-timeline@c2f474758e8e9ac6f37ec64a6442dead7fd1dad2 # v2.2.5
53+
continue-on-error: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ A GitHub Action to create a new Unity Project using a predefined template packag
1111
>
1212
> You can use [`unity-setup`](https://github.com/RageAgainstThePixel/unity-setup) action to install Unity Editor before using this action.
1313
14-
- `UNITY_EDITOR_PATH` environment variable must be set to the path of the Unity Editor executable.
14+
***`UNITY_EDITOR_PATH` environment variable must be set to the path of the Unity Editor executable.***
1515

1616
> [!IMPORTANT]
1717
> This action requires an active Unity license be available on the runner.
1818
>
1919
> You can use [`activate-unity-license`](https://github.com/RageAgainstThePixel/activate-unity-license) action to activate the Unity license before using this action.
2020
21-
- A license activation for the Unity Editor must also be completed before using this action.
21+
***A license activation for the Unity Editor must also be completed before using this action.***
2222

2323
### workflow
2424

2525
```yaml
2626
steps:
27-
- uses: RageAgainstThePixel/create-unity-project@v1
27+
- uses: RageAgainstThePixel/create-unity-project@v2
2828
with:
2929
project-name: Test Project
3030
project-directory: ./Unity Project

action.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,6 @@ inputs:
1818
outputs:
1919
project-path:
2020
description: The path to the created Unity project.
21-
value: '${{ inputs.project-directory }}/${{ inputs.project-name }}'
2221
runs:
23-
using: composite
24-
steps:
25-
- name: Get Unity Template
26-
id: template
27-
shell: bash
28-
env:
29-
ACTION_PATH: ${{ github.action_path }}
30-
TEMPLATE_NAME: ${{ inputs.template-name }}
31-
run: '"${ACTION_PATH}/get-unity-template.sh" "${TEMPLATE_NAME}"'
32-
- uses: RageAgainstThePixel/unity-action@v2
33-
name: Create Unity Project
34-
with:
35-
log-name: create-unity-project
36-
args: '-quit -nographics -batchmode -createProject "${{ inputs.project-directory }}/${{ inputs.project-name }}" -cloneFromTemplate "${{ steps.template.outputs.template-path }}"'
22+
using: 'node20'
23+
main: 'dist/index.js'

0 commit comments

Comments
 (0)