Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.

Commit 0da2f5a

Browse files
@xrtk/activate-unity-license@v2 (#3)
1 parent b9da55a commit 0da2f5a

File tree

8 files changed

+33
-43
lines changed

8 files changed

+33
-43
lines changed

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
username: ${{ secrets.UNITY_USERNAME }}
5252
password: ${{ secrets.UNITY_PASSWORD }}
5353
# Optional
54-
license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
5554
serial: ${{ secrets.UNITY_SERIAL }} # Required for pro/plus activations
55+
license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
5656

5757
- name: Unity Build (${{ matrix.build-target }})
5858
uses: xrtk/unity-action@v4

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ jobs:
6161
- uses: xrtk/unity-setup@v4
6262

6363
# Activates the installation with the provided credentials
64-
- uses: xrtk/activate-unity-license@v1
64+
- uses: xrtk/activate-unity-license@v2
6565
with:
6666
# Required
6767
username: ${{ secrets.UNITY_USERNAME }}
6868
password: ${{ secrets.UNITY_PASSWORD }}
6969
# Optional
70-
license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
7170
serial: ${{ secrets.UNITY_SERIAL }} # Required for pro/plus activations
71+
license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
7272
```

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ inputs:
1212
description: 'Unity Password'
1313
required: true
1414
default: ''
15-
license-type:
16-
description: 'License type to activate (professional or personal)'
17-
required: false
18-
default: 'Personal'
1915
serial:
2016
description: 'Unity Serial (Only used for Professional license type)'
2117
required: false
2218
default: ''
19+
license-type:
20+
description: 'License type to activate (professional or personal)'
21+
required: false
22+
default: 'Personal'
2323
runs:
2424
using: 'node16'
2525
main: 'dist/index.js'

dist/index.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34198,10 +34198,9 @@ async function Run() {
3419834198
throw Error('Missing password input');
3419934199
}
3420034200

34201-
var licenseType = core.getInput('license-type');
34202-
3420334201
var pwsh = await io.which("pwsh", true);
3420434202
var unity_action = __nccwpck_require__.ab + "unity-action.ps1";
34203+
var licenseType = core.getInput('license-type');
3420534204

3420634205
if (licenseType.toLowerCase().startsWith('pro')) {
3420734206
// if pro/plus license activate by using UNITY_SERIAL env variable
@@ -34214,27 +34213,25 @@ async function Run() {
3421434213
// Unity only likes to mask the last 4 characters of serial.
3421534214
// Let's mask all of it.
3421634215
var maskedSerial = serial.slice(0, -4) + `XXXX`;
34217-
console.log(`::add-mask::${maskedSerial}`);
34216+
core.setSecret(maskedSerial);
3421834217

34219-
// -quit -batchmode -username [email protected] -password XXXXXXXXXXXXX -serial E3-XXXX-XXXX-XXXX-XXXX-XXXX
34218+
core.startGroup(`Activate Unity Professional License`);
3422034219
var args = `-quit -nographics -batchmode -username ${username} -password ${password} -serial ${serial}`;
34221-
console.log(`::group::Activate Unity Professional License`);
3422234220
var exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ProLicenseActivation`);
34223-
console.log(`::endgroup::`);
34221+
core.endGroup();
3422434222
} else if (licenseType.toLowerCase().startsWith('per')) {
3422534223
// if personal license activate by using requesting activation file
34226-
var args = `-quit -nographics -batchmode -createManualActivationFile`; //-username ${username} -password ${password}
34224+
core.startGroup(`Generate Unity License Request File`);
3422734225
var exitCode = 0;
34228-
34229-
console.log(`::group::Generate Unity License Request File`);
34226+
var args = `-quit -nographics -batchmode -createManualActivationFile`;
3423034227

3423134228
try {
3423234229
exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ManualLicenseRequest`);
3423334230
} catch (error) {
3423434231
//console.error(error.message);
3423534232
}
3423634233

34237-
console.log(`::endgroup::`);
34234+
core.endGroup();
3423834235

3423934236
var exeDir = path.resolve(process.cwd());
3424034237
core.debug(`exeDir: ${exeDir}`);
@@ -34247,7 +34244,7 @@ async function Run() {
3424734244
throw Error(`Failed to find generated license alf request file!`);
3424834245
}
3424934246

34250-
console.log(`::group::Download Unity License Activation File`);
34247+
core.startGroup(`Download Unity License Activation File`);
3425134248

3425234249
await new Activator({
3425334250
file: alfPath,
@@ -34263,7 +34260,7 @@ async function Run() {
3426334260
core.error(e.message);
3426434261
});
3426534262

34266-
console.log(`::endgroup::`);
34263+
core.endGroup();
3426734264

3426834265
files = await findByExtension(exeDir, '.ulf');
3426934266
var ulfPath = files[0];
@@ -34274,11 +34271,9 @@ async function Run() {
3427434271
throw Error(`Failed to find manual license ulf file!`);
3427534272
}
3427634273

34277-
// "-batchmode -manualLicenseFile ./UnityLicenseRequest.ulf"
34274+
core.startGroup(`Activate Unity Personal License`);
3427834275
args = `-quit -nographics -batchmode -manualLicenseFile ""${ulfPath}""`;
3427934276

34280-
console.log(`::group::Activate Unity Personal License`);
34281-
3428234277
try {
3428334278
exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName PersonalLicenseActivation`);
3428434279
} catch (error) {
@@ -34289,7 +34284,7 @@ async function Run() {
3428934284
fs.unlink(alfPath, () => core.debug(`removed: ${alfPath}`));
3429034285
fs.unlink(ulfPath, () => core.debug(`removed: ${ulfPath}`));
3429134286

34292-
console.log(`::endgroup::`);
34287+
core.endGroup();
3429334288
} else {
3429434289
core.setFailed(`Invalid License type provided: '${licenseType}' | expects: 'professional' or 'personal'`);
3429534290
}

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "activate-unity-license",
3-
"version": "1.0.0",
3+
"version": "2.0.0",
44
"description": "An atomic GitHub Action that activates the Unity Engine license via cli with the provided secret parameters.",
55
"main": "src/index.js",
66
"dependencies": {

src/activate.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ async function Run() {
3232
throw Error('Missing password input');
3333
}
3434

35-
var licenseType = core.getInput('license-type');
36-
3735
var pwsh = await io.which("pwsh", true);
3836
var unity_action = path.resolve(__dirname, 'unity-action.ps1');
37+
var licenseType = core.getInput('license-type');
3938

4039
if (licenseType.toLowerCase().startsWith('pro')) {
4140
// if pro/plus license activate by using UNITY_SERIAL env variable
@@ -48,27 +47,25 @@ async function Run() {
4847
// Unity only likes to mask the last 4 characters of serial.
4948
// Let's mask all of it.
5049
var maskedSerial = serial.slice(0, -4) + `XXXX`;
51-
console.log(`::add-mask::${maskedSerial}`);
50+
core.setSecret(maskedSerial);
5251

53-
// -quit -batchmode -username [email protected] -password XXXXXXXXXXXXX -serial E3-XXXX-XXXX-XXXX-XXXX-XXXX
52+
core.startGroup(`Activate Unity Professional License`);
5453
var args = `-quit -nographics -batchmode -username ${username} -password ${password} -serial ${serial}`;
55-
console.log(`::group::Activate Unity Professional License`);
5654
var exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ProLicenseActivation`);
57-
console.log(`::endgroup::`);
55+
core.endGroup();
5856
} else if (licenseType.toLowerCase().startsWith('per')) {
5957
// if personal license activate by using requesting activation file
60-
var args = `-quit -nographics -batchmode -createManualActivationFile`; //-username ${username} -password ${password}
58+
core.startGroup(`Generate Unity License Request File`);
6159
var exitCode = 0;
62-
63-
console.log(`::group::Generate Unity License Request File`);
60+
var args = `-quit -nographics -batchmode -createManualActivationFile`;
6461

6562
try {
6663
exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ManualLicenseRequest`);
6764
} catch (error) {
6865
//console.error(error.message);
6966
}
7067

71-
console.log(`::endgroup::`);
68+
core.endGroup();
7269

7370
var exeDir = path.resolve(process.cwd());
7471
core.debug(`exeDir: ${exeDir}`);
@@ -81,7 +78,7 @@ async function Run() {
8178
throw Error(`Failed to find generated license alf request file!`);
8279
}
8380

84-
console.log(`::group::Download Unity License Activation File`);
81+
core.startGroup(`Download Unity License Activation File`);
8582

8683
await new Activator({
8784
file: alfPath,
@@ -97,7 +94,7 @@ async function Run() {
9794
core.error(e.message);
9895
});
9996

100-
console.log(`::endgroup::`);
97+
core.endGroup();
10198

10299
files = await findByExtension(exeDir, '.ulf');
103100
var ulfPath = files[0];
@@ -108,11 +105,9 @@ async function Run() {
108105
throw Error(`Failed to find manual license ulf file!`);
109106
}
110107

111-
// "-batchmode -manualLicenseFile ./UnityLicenseRequest.ulf"
108+
core.startGroup(`Activate Unity Personal License`);
112109
args = `-quit -nographics -batchmode -manualLicenseFile ""${ulfPath}""`;
113110

114-
console.log(`::group::Activate Unity Personal License`);
115-
116111
try {
117112
exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName PersonalLicenseActivation`);
118113
} catch (error) {
@@ -123,7 +118,7 @@ async function Run() {
123118
fs.unlink(alfPath, () => core.debug(`removed: ${alfPath}`));
124119
fs.unlink(ulfPath, () => core.debug(`removed: ${ulfPath}`));
125120

126-
console.log(`::endgroup::`);
121+
core.endGroup();
127122
} else {
128123
core.setFailed(`Invalid License type provided: '${licenseType}' | expects: 'professional' or 'personal'`);
129124
}

0 commit comments

Comments
 (0)