Skip to content

homuler/unity-license-activate

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License Release npm npm-dm

unity-license-activate

A tool to automate the manual activation of unity license using puppeteer

dependencies Status

This is a fork from MizoTake/unity-license-activate.

This tool is design to use with GameCI and personal license (free version) users. Personal license will expire after some times, then you most likely would have to repeast the step Activation - Personal License in order to keep the CI running. Thankfully, you can use this tool to constantly activate a new license from Unity's licensing system.

🔨 How to use?

You can use this tools with any CI/CD system as long as you have the Node environment set up! Here is an example for GitHub Actions.

jobs:
  acquire_ulf:
    name: Acquire .ulf file 🔑
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x]
    steps:
      - name: Set up Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install node package, `unity-license-activate`
        run: npm install --global unity-license-activate

      - name: Activate the license
        run: unity-license-activate "${{ secrets.UNITY_EMAIL }}" "${{ secrets.UNITY_PASSWORD }}" "${{ needs.request_alf.outputs.alf }}"

      - name: Read ulf
        id: ulfRead
        uses: juliangruber/read-file-action@v1.1.4
        with:
          path: ${{ env.ULF_FILE }}

      - name: Update secret UNITY_LICENSE
        uses: hmanzur/actions-set-secret@v2.0.0
        with:
          name: 'UNITY_LICENSE'
          value: '${{ steps.ulfRead.outputs.content }}'
          token: ${{ secrets.ACCESS_TOKEN }}

See the full example here.

🔐 Two Factor Authentication (TFA)

If you've enabled TFA, Unity requests you to enter a 6 digit verification code. This fork drops support for Phone number but supports Authenticator App (TOTP).

To pass the authentication step, specify your authentication key.

      - name: Activate the license
        run: unity-license-activate ... --authenticator-key "${{ secrets.UNITY_TOTP_KEY }}"

㊙️ Secrets

You should have 3 ~ 4 GitHub secrets to correctly set up the entire workflow.

  • UNITY_EMAIL - Email address that you use to login to Unity
  • UNITY_PASSWORD - Password that you use to login to Unity
  • ACCESS_TOKEN - Use to update secret UNITY_LICENSE, see hmanzur/actions-set-secret#token
  • UNITY_TOTP_KEY (optional) - Use to pass Unity's Two Factor Authentication,

🩺 Error handling

For some reason, if this plugin does not work. Try configure your workflow file like this,

      - name: Activate the license
        continue-on-error: true        # Add this line to get pass the error flag
        run: unity-license-activate "${{ secrets.UNITY_EMAIL }}" "${{ secrets.UNITY_PASSWORD }}" "${{ needs.request_alf.outputs.alf }}"

      # Add the error handling step here!
      - name: 🩺 Upload error screenshot
        uses: actions/upload-artifact@v1
        with:
          name: screenshot_error
          path: error.png

The program generates a error.png file if something went wrong. Then you can download and see what's the last step before the program is exited.

📇 Command Line Arguments

usage : unity-license-activate EMAIL [EMAIL ...] PASSWORD [PASSWORD ...] ALF [ALF ...]

Unity License Activate : Activate Unity license through CLI.

positional arguments:
  EMAIL          Username or Email you use to register for Unity account
  PASSWORD       Password to login Unity account
  ALF            Unity activation license file path

🔗 Links

Packages

No packages published

Languages

  • JavaScript 100.0%