Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Fix `androidTargetSdk` version parse
  • Loading branch information
StephenHodgson authored Aug 6, 2024
1 parent 2516a28 commit c8dedf1
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
15 changes: 8 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31352,15 +31352,16 @@ const path = __nccwpck_require__(1017);
const os = __nccwpck_require__(2037);

async function CheckAndroidSdkInstalled(editorPath, projectPath) {
core.startGroup('Validating Android Target SDK Installed...');
let sdkPath = undefined;
await createRepositoryCfg();
const rootEditorPath = await GetEditorRootPath(editorPath);
const projectSettingsPath = path.join(projectPath, 'ProjectSettings/ProjectSettings.asset');
const projectSettingsContent = await ReadFileContents(projectSettingsPath);
const androidTargetSdk = parseInt(projectSettingsContent.match(/(?<=AndroidTargetSdkVersion: )\d+/));
core.debug(`AndroidTargetSdkVersion:\n > ${androidTargetSdk}`);
if (androidTargetSdk === undefined || androidTargetSdk === 0) { return; }
core.startGroup('Validating Android Target SDK Installed...');
try {
await createRepositoryCfg();
const rootEditorPath = await GetEditorRootPath(editorPath);
const projectSettingsPath = path.join(projectPath, 'ProjectSettings/ProjectSettings.asset');
const projectSettingsContent = await ReadFileContents(projectSettingsPath);
const androidTargetSdk = projectSettingsContent.match(/(?<=AndroidTargetSdkVersion: )\d+/);
if (androidTargetSdk === undefined || androidTargetSdk === 0) { return; }
sdkPath = await getAndroidSdkPath(rootEditorPath, androidTargetSdk);
if (sdkPath) {
core.info(`Target Android SDK android-${androidTargetSdk} Installed in:\n > "${sdkPath}"`);
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.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unity-setup",
"version": "1.0.1",
"version": "1.0.2",
"description": "A GitHub action for setting up the Unity Game Engine for CI/CD workflows.",
"author": "Buildalon",
"license": "MIT",
Expand Down
15 changes: 8 additions & 7 deletions src/install-android-sdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ const path = require('path');
const os = require('os');

async function CheckAndroidSdkInstalled(editorPath, projectPath) {
core.startGroup('Validating Android Target SDK Installed...');
let sdkPath = undefined;
await createRepositoryCfg();
const rootEditorPath = await GetEditorRootPath(editorPath);
const projectSettingsPath = path.join(projectPath, 'ProjectSettings/ProjectSettings.asset');
const projectSettingsContent = await ReadFileContents(projectSettingsPath);
const androidTargetSdk = parseInt(projectSettingsContent.match(/(?<=AndroidTargetSdkVersion: )\d+/));
core.debug(`AndroidTargetSdkVersion:\n > ${androidTargetSdk}`);
if (androidTargetSdk === undefined || androidTargetSdk === 0) { return; }
core.startGroup('Validating Android Target SDK Installed...');
try {
await createRepositoryCfg();
const rootEditorPath = await GetEditorRootPath(editorPath);
const projectSettingsPath = path.join(projectPath, 'ProjectSettings/ProjectSettings.asset');
const projectSettingsContent = await ReadFileContents(projectSettingsPath);
const androidTargetSdk = projectSettingsContent.match(/(?<=AndroidTargetSdkVersion: )\d+/);
if (androidTargetSdk === undefined || androidTargetSdk === 0) { return; }
sdkPath = await getAndroidSdkPath(rootEditorPath, androidTargetSdk);
if (sdkPath) {
core.info(`Target Android SDK android-${androidTargetSdk} Installed in:\n > "${sdkPath}"`);
Expand Down

0 comments on commit c8dedf1

Please sign in to comment.