Skip to content

[email protected] #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
schedule:
- cron: '0 0 * * 0' # Run every Sunday at midnight
push:
branches: ['main']
branches: [main]
pull_request:
branches: ['*']
# Allows you to run this workflow manually from the Actions tab
Expand All @@ -25,13 +25,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
unity-versions:
unity-version:
- None
- '5.6.7f1 (e80cc3114ac1)'
- 2019.4.40f1
- 5.6.7f1 (e80cc3114ac1)
- 2020.3
- 2021.3.x
- 2022.x
- 6000.0.x
- 6000
include:
- os: ubuntu-latest
Expand All @@ -43,17 +43,26 @@ jobs:
- os: macos-latest
build-targets: StandaloneOSX Android iOS VisionOS
modules: mac-server
- os: ubuntu-latest
unity-version: 2019.4.40f1
modules: None
- os: ubuntu-latest
unity-version: 2018.4.36f1 (6cd387d23174)
modules: None
- os: ubuntu-latest
unity-version: 2017.4.40f1 (6e14067f8a9a)
modules: None
exclude:
# Exclude Unity 5.x for linux as it is not supported
- os: ubuntu-latest
unity-versions: '5.6.7f1 (e80cc3114ac1)'
unity-version: '5.6.7f1 (e80cc3114ac1)'
steps:
- uses: actions/checkout@v4

- uses: ./ # buildalon/unity-setup
with:
version-file: 'None'
unity-version: ${{ matrix.unity-versions }}
unity-version: ${{ matrix.unity-version }}
build-targets: ${{ matrix.build-targets }}
modules: ${{ matrix.modules }}

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A GitHub Action for setting up the [Unity Game Engine](https://unity.com) for CI
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
unity-versions:
unity-version:
- None
- 2019.4.40f1 (ffc62b691db5)
- 2020.x
Expand All @@ -33,7 +33,7 @@ steps:
- uses: buildalon/unity-setup@v1
with:
version-file: 'path/to/your/unity/project/ProjectSettings/ProjectVersion.txt'
unity-version: ${{ matrix.unity-versions }} # overrides version in version-file
unity-version: ${{ matrix.unity-version }} # overrides version in version-file
build-targets: ${{ matrix.build-targets }}
modules: ${{ matrix.modules }}

Expand Down
50 changes: 25 additions & 25 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34132,21 +34132,22 @@ async function ValidateInputs() {
core.info(`architecture:\n > ${architecture}`);
}
const buildTargets = getArrayInput('build-targets');
core.info(`modules:`);
const modulesInput = getArrayInput('modules');
if (buildTargets.length == 0) {
if (modulesInput.length > 0) {
modules.push(...modulesInput);
}
else {
modules.push(...getDefaultModules());
if (buildTargets.length == 0 && modulesInput.length === 0) {
modules.push(...getDefaultModules());
for (const module of modules) {
core.info(` > ${module}`);
}
}
else {
modules.push(...modulesInput);
}
core.info(`modules:`);
for (const module of modulesInput) {
core.info(` > ${module}`);
if (module.toLowerCase() == 'none') {
continue;
}
if (!modules.includes(module)) {
modules.push(module);
core.info(` > ${module}`);
}
}
core.info(`buildTargets:`);
const moduleMap = getPlatformTargetModuleMap();
Expand All @@ -34158,11 +34159,8 @@ async function ValidateInputs() {
}
if (!modules.includes(module)) {
modules.push(module);
core.info(` > ${target} -> ${module}`);
}
core.info(` > ${target} -> ${module}`);
}
if (modules.length == 0) {
throw Error('No modules or build-targets provided!');
}
const versions = getUnityVersionsFromInput();
const versionFilePath = await getVersionFilePath();
Expand Down Expand Up @@ -34261,11 +34259,11 @@ function getPlatformTargetModuleMap() {
function getDefaultModules() {
switch (process.platform) {
case 'linux':
return ['linux-il2cpp', 'android', 'ios'];
return ['linux-il2cpp'];
case 'darwin':
return ['mac-il2cpp', 'android', 'ios'];
return ['mac-il2cpp'];
case 'win32':
return ['windows-il2cpp', 'android', 'universal-windows-platform'];
return ['windows-il2cpp'];
default:
throw Error(`${process.platform} not supported`);
}
Expand Down Expand Up @@ -34974,12 +34972,14 @@ async function getChangeset(version) {
return null;
}
async function removePath(targetPath) {
core.startGroup(`deleting ${targetPath}...`);
try {
await fs.promises.rm(targetPath, { recursive: true, force: true });
}
finally {
core.endGroup();
if (targetPath && targetPath.length > 0) {
core.startGroup(`deleting ${targetPath}...`);
try {
await fs.promises.rm(targetPath, { recursive: true, force: true });
}
finally {
core.endGroup();
}
}
}

Expand Down Expand Up @@ -45598,7 +45598,7 @@ const main = async () => {
const unityHubPath = await unityHub.Get();
core.exportVariable('UNITY_HUB_PATH', unityHubPath);
const editors = [];
if (installPath.length > 0) {
if (installPath && installPath.length > 0) {
await unityHub.SetInstallPath(installPath);
}
for (const [version, changeset] of versions) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unity-setup",
"version": "1.1.0",
"version": "1.1.1",
"description": "A GitHub action for setting up the Unity Game Engine for CI/CD workflows.",
"author": "Buildalon",
"license": "MIT",
Expand Down Expand Up @@ -44,4 +44,4 @@
"watch": "ncc build src/index.ts -o dist --source-map --license licenses.txt --watch",
"clean": "npm install && shx rm -rf dist/ out/ node_modules/ && npm ci"
}
}
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const main = async () => {
const unityHubPath = await unityHub.Get();
core.exportVariable('UNITY_HUB_PATH', unityHubPath);
const editors = [];
if (installPath.length > 0) {
if (installPath && installPath.length > 0) {
await unityHub.SetInstallPath(installPath);
}
for (const [version, changeset] of versions) {
Expand Down
36 changes: 18 additions & 18 deletions src/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,29 @@ import path = require('path');
import os = require('os');
import fs = require('fs');

export async function ValidateInputs(): Promise<[string[][], string | undefined, string[], string | undefined, string | undefined]> {
const modules = [];
export async function ValidateInputs(): Promise<[string[][], string | undefined, string[], string | undefined, string]> {
const modules: string[] = [];
const architecture = core.getInput('architecture') || getInstallationArch();
if (architecture) {
core.info(`architecture:\n > ${architecture}`);
}
const buildTargets = getArrayInput('build-targets');
core.info(`modules:`);
const modulesInput = getArrayInput('modules');
if (buildTargets.length == 0) {
if (modulesInput.length > 0) {
modules.push(...modulesInput);
} else {
modules.push(...getDefaultModules());
if (buildTargets.length == 0 && modulesInput.length === 0) {
modules.push(...getDefaultModules());
for (const module of modules) {
core.info(` > ${module}`);
}
} else {
modules.push(...modulesInput);
}
core.info(`modules:`);
for (const module of modulesInput) {
core.info(` > ${module}`);
if (module.toLowerCase() == 'none') {
continue;
}
if (!modules.includes(module)) {
modules.push(module);
core.info(` > ${module}`);
}
}
core.info(`buildTargets:`);
const moduleMap = getPlatformTargetModuleMap();
Expand All @@ -36,11 +39,8 @@ export async function ValidateInputs(): Promise<[string[][], string | undefined,
}
if (!modules.includes(module)) {
modules.push(module);
core.info(` > ${target} -> ${module}`);
}
core.info(` > ${target} -> ${module}`);
}
if (modules.length == 0) {
throw Error('No modules or build-targets provided!');
}
const versions = getUnityVersionsFromInput();
const versionFilePath = await getVersionFilePath();
Expand Down Expand Up @@ -137,11 +137,11 @@ function getPlatformTargetModuleMap(): { [key: string]: string } {
function getDefaultModules(): string[] {
switch (process.platform) {
case 'linux':
return ['linux-il2cpp', 'android', 'ios'];
return ['linux-il2cpp'];
case 'darwin':
return ['mac-il2cpp', 'android', 'ios'];
return ['mac-il2cpp'];
case 'win32':
return ['windows-il2cpp', 'android', 'universal-windows-platform'];
return ['windows-il2cpp'];
default:
throw Error(`${process.platform} not supported`);
}
Expand Down
14 changes: 8 additions & 6 deletions src/unity-hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,13 @@ async function getChangeset(version: string): Promise<string | null> {
return null;
}

async function removePath(targetPath: string): Promise<void> {
core.startGroup(`deleting ${targetPath}...`);
try {
await fs.promises.rm(targetPath, { recursive: true, force: true });
} finally {
core.endGroup();
async function removePath(targetPath: string | undefined): Promise<void> {
if (targetPath && targetPath.length > 0) {
core.startGroup(`deleting ${targetPath}...`);
try {
await fs.promises.rm(targetPath, { recursive: true, force: true });
} finally {
core.endGroup();
}
}
}
Loading