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

Commit

Permalink
@xrtk/activate-unity-license@v1 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson authored Nov 9, 2022
1 parent 380eb27 commit 6dd9a21
Show file tree
Hide file tree
Showing 25 changed files with 58,237 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: StephenHodgson
79 changes: 79 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: validate

on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.ref }}

jobs:
validate:
runs-on: ${{ matrix.os }}
strategy:
#max-parallel: 2 # Use this if you're activating pro license with matrix
matrix:
include:
- os: ubuntu-latest
build-target: StandaloneLinux64
- os: windows-latest
build-target: StandaloneWindows64
- os: macos-latest
build-target: StandaloneOSX

steps:
- name: checkout self
uses: actions/checkout@v3

- run: npm install

- name: checkout test project
uses: actions/checkout@v3
with:
repository: xrtk/com.xrtk.test
path: test-project

- uses: xrtk/unity-setup@v4
with:
version-file-path: 'test-project/**/ProjectSettings/ProjectVersion.txt'

- name: xrtk/activate-unity-license
uses: ./
with:
# Required
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
# Optional
license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
serial: ${{ secrets.UNITY_SERIAL }} # Required for pro/plus activations

- name: Unity Build (${{ matrix.build-target }})
uses: xrtk/unity-action@refactor
with:
log-name: 'project-validation'
args: '-quit -nographics -batchmode -executeMethod XRTK.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject'

- uses: actions/upload-artifact@v3
name: Upload Artifacts
if: always()
with:
name: '${{ runner.os }}-${{ matrix.build-target }}-Artifacts'
path: '${{ env.UNITY_PROJECT_PATH }}/Builds'

- name: Clean Artifacts
if: always()
run: |
# Clean Artifacts
$artifacts = "${{ env.UNITY_PROJECT_PATH }}/Builds"
if (Test-Path -Path $artifacts) {
Remove-Item $artifacts -Force -Recurse
}
shell: pwsh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cache/
node_modules
9 changes: 9 additions & 0 deletions .puppeteerrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const {join} = require('path');

/**
* @type {import("puppeteer").Configuration}
*/
module.exports = {
// Changes the cache location for Puppeteer.
cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
};
74 changes: 72 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,72 @@
# activeate-unity-license
GitHub Action to activate unity license from secrets
# activate-unity-license

An atomic GitHub Action that activates the Unity Engine license via cli with the provided secret parameters.

Part of the [Mixed Reality Toolkit (XRTK)](https://github.com/XRTK) open source project.

> This action does not require the use of XRTK in your Unity project.
## Related Github Actions

* [xrtk/unity-setup](https://github.com/XRTK/unity-setup) Downloads and installs the unity editor.
* [xrtk/unity-action](https://github.com/XRTK/unity-action) An cli tool for passing commands to the Unity Engine.
* [xrtk/unity-build](https://github.com/XRTK/unity-build) ***(Requires XRTK plugin in Unity Project)***

## How to use

This action uses your stored environment secrets to authenticate with the Unity Licensing servers.

***It's important that you disable other forks of your repository to run actions in pull requests from unknown contributors.***

> Read more on [Approving workflow runs from public forks](
https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks)

[![Managing GitHub Actions settings for a repository](RecommendedSecuritySettings.png)](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository)

### Setup Secrets

This action requires several secrets that need to be setup in the repository or organization's action secret store.

* `UNITY_USERNAME` The email address you use for your Unity Id
* `UNITY_PASSWORD` The password you use for Unity Id access
* `UNITY_SERIAL` (Required for pro/plus activations)

> Don't forget that pro/plus licenses only support 2 active licenses at a time!
### Create Workflow file

```yml
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
#max-parallel: 2 # Use this if you're activating pro license with matrix
matrix:
include:
- os: ubuntu-latest
build-target: StandaloneLinux64
- os: windows-latest
build-target: StandaloneWindows64
- os: macos-latest
build-target: StandaloneOSX

steps:
- name: checkout self
uses: actions/checkout@v3

# Installs the Unity Editor based on your project version text file
# sets -> env.UNITY_EDITOR_PATH
# sets -> env.UNITY_PROJECT_PATH
# https://github.com/XRTK/unity-setup
- uses: xrtk/unity-setup@v4

# Activates the installation with the provided credentials
- uses: xrtk/activate-unity-license@v1
with:
# Required
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
# Optional
license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
serial: ${{ secrets.UNITY_SERIAL }} # Required for pro/plus activations
```
Binary file added RecommendedSecuritySettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'Unity License Activation (XRTK)'
description: 'Runs Unity with the provided options'
branding:
icon: 'at-sign'
color: 'blue'
inputs:
username:
description: 'Unity Username'
required: true
default: ''
password:
description: 'Unity Password'
required: true
default: ''
license-type:
description: 'License type to activate (professional or personal)'
required: false
default: 'Personal'
serial:
description: 'Unity Serial (Only used for Professional license type)'
required: false
default: ''
runs:
using: 'node16'
main: 'dist/index.js'
post: 'dist/index.js'
Loading

0 comments on commit 6dd9a21

Please sign in to comment.