rmgomez / unity-cloud-build-app-center

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unity Cloud Build To App Center

A NodeJS application to automate binary deployments from Unity Cloud Build to App Center.

App Flow

  1. Receive a webhook from Unity Cloud Build to notify a build is ready.
  2. Get the build details from the JSON payload within the webhook.
  3. Download the app binary from the Unity Cloud Build API.
  4. Upload the app binary to App Center.

Requirements

Env variables

  • UNITYCLOUD_KEY - Unity Cloud Build API key
  • UNITYCLOUD_SECRET - shared secret used by Unity Cloud Build to sign the request when sending webhook. This signature need to be valid, otherwise the request will be ignored If this variable is not provided, signature check will be disabled (ie. all requests will be accepted).
  • APPCENTER_KEY - App Center API key (the your user API Key)

URL configuration

When setting up the webhook in Unity Cloud Build, you can provide all the required configuration in the URL query string.

  • ownerName - name of the owner of the App Center application
  • appName - name of the App Center application
  • team - name of the team to distribute the app to on App Center
  • excludeTargets - comma-separated list of Unity Cloud Build targets that shouldn't be deployed to App Center
  • includeTargets - comma-separated list of Unity Cloud Build targets that should be deployed to App Center (targets not on this list will be excluded)

Installation

  1. Pull the Docker image.
  2. Create API keys for both Unity Cloud Build and App Center.
    • UCB API key can be obtained here.
    • App Center API key can be created here.
  3. Deploy the Docker image.
  4. Setup the Unity Cloud Build webhook.

Unity Cloud Build Webhook

  1. Within UCB, view your app.
  2. Click 'Integrations'.
  3. 'Add New' and enter your app URL with '/build' appended. E.g. 'https://[appurl]/build?ownerName=rmgomez&appName=Test-UCB-iOS&includeTargets=Dev%20iOS'
  4. Create and set a new Authorization Secret (this will be your UNITYCLOUD_SECRET env var)
  5. Set the Authorization Type as HMAC-SHA256 Signature

Troubleshooting

Use a tool like ngrok to test web hooks from Unity Cloud Build and verify their payload.

Notes

  • If you use Slack, integrate UCB and App Center to be notified when a new build is ready and has been pushed to App Center.
  • Configure App Center to automatically notify users after the binary is uploaded.

Todo

  • Integrate job system to manage/prioritise jobs and view jobs in progress.

Licenses

Copyright 2016 Nathan Brodbent

This software is licensed under Apache License 2.0.

About


Languages

Language:JavaScript 98.1%Language:Dockerfile 1.1%Language:HTML 0.8%