Skip to content
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

activate-unity-license@v1.0.5 #6

Merged
merged 4 commits into from
Dec 12, 2024
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
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ inputs:
default: 'Personal'
username:
description: 'The email address you use for your Unity Id. Required for `Personal` and `Professional` license activations.'
required: true
required: false
default: ''
password:
description: 'The password you use for Unity Id access. Required for `Personal` and `Professional` license activations.'
required: true
required: false
default: ''
serial:
description: 'The Serial number for the seat. Required for Professional license activations.'
Expand Down
30 changes: 27 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28598,6 +28598,7 @@ exports["default"] = _default;

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Activate = Activate;
const process_1 = __nccwpck_require__(7282);
const licenseClient = __nccwpck_require__(8447);
const core = __nccwpck_require__(2186);
async function Activate() {
Expand Down Expand Up @@ -28627,9 +28628,24 @@ async function Activate() {
await licenseClient.ActivateLicenseWithConfig(servicesConfig);
}
else {
const username = core.getInput('username', { required: true }).trim();
const password = core.getInput('password', { required: true }).trim();
const serial = core.getInput('serial', { required: license.toLowerCase().startsWith('pro') });
const pro = license.toLowerCase().startsWith('pro');
let username = core.getInput('username', { required: pro }).trim();
let password = core.getInput('password', { required: pro }).trim();
const serial = core.getInput('serial', { required: pro });
if (!username) {
const encodedUsername = process_1.env['UNITY_USERNAME_BASE64'];
if (!encodedUsername) {
throw Error('Username is required for Unity License Activation!');
}
username = Buffer.from(encodedUsername, 'base64').toString('utf-8');
}
if (!password) {
const encodedPassword = process_1.env['UNITY_PASSWORD_BASE64'];
if (!encodedPassword) {
throw Error('Password is required for Unity License Activation!');
}
password = Buffer.from(encodedPassword, 'base64').toString('utf-8');
}
await licenseClient.ActivateLicense(username, password, serial);
}
activeLicenses = await licenseClient.ShowEntitlements();
Expand Down Expand Up @@ -29091,6 +29107,14 @@ module.exports = require("perf_hooks");

/***/ }),

/***/ 7282:
/***/ ((module) => {

"use strict";
module.exports = require("process");

/***/ }),

/***/ 3477:
/***/ ((module) => {

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": "activate-unity-license",
"version": "1.0.4",
"version": "1.0.5",
"description": "A GitHub Action to activate a Unity Game Engine license for CI/CD workflows.",
"author": "buildalon",
"license": "MIT",
Expand Down
27 changes: 24 additions & 3 deletions src/activate.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { env } from 'process';
import licenseClient = require('./licensing-client');
import core = require('@actions/core');

Expand Down Expand Up @@ -27,9 +28,29 @@ async function Activate(): Promise<void> {
const servicesConfig = core.getInput('services-config', { required: true });
await licenseClient.ActivateLicenseWithConfig(servicesConfig);
} else {
const username = core.getInput('username', { required: true }).trim();
const password = core.getInput('password', { required: true }).trim();
const serial = core.getInput('serial', { required: license.toLowerCase().startsWith('pro') });
const pro = license.toLowerCase().startsWith('pro');
let username = core.getInput('username', { required: pro }).trim();
let password = core.getInput('password', { required: pro }).trim();
afarchy marked this conversation as resolved.
Show resolved Hide resolved
const serial = core.getInput('serial', { required: pro });

if (!username) {
const encodedUsername = env['UNITY_USERNAME_BASE64'];
if (!encodedUsername) {
throw Error('Username is required for Unity License Activation!');
}

username = Buffer.from(encodedUsername, 'base64').toString('utf-8');
}

if (!password) {
const encodedPassword = env['UNITY_PASSWORD_BASE64'];
if (!encodedPassword) {
throw Error('Password is required for Unity License Activation!');
}

password = Buffer.from(encodedPassword, 'base64').toString('utf-8');
}

await licenseClient.ActivateLicense(username, password, serial);
}
activeLicenses = await licenseClient.ShowEntitlements();
Expand Down
Loading