-
Notifications
You must be signed in to change notification settings - Fork 2
1. Creating a Unity Project with CI CD pipeline
Shahid Karim edited this page May 12, 2020
·
1 revision
- Create a new Github Repo with GNU General Public License v3.0 and a Unity .gitignore file.
- Create a new Unity Project.
- Copy the clone url from Github repo page (Something like: https://github.com/h1ddengames/Motherload-Clone.git)
- Go into the main Unity Project folder, then open a terminal. (The main folder being where you can see the Asset, Library, Logs and other folders)
- Type git clone https://github.com/h1ddengames/Motherload-Clone.git where the link is the url you copied from step 3.
- Move the .git folder, .gitignore and LICENSE file into the main Unity Project folder.
- Create these folders in the main Unity Project folder .gitignore/workflows
- Create activation.yml in .gitignore/workflows with the code from the section Acquire Activation File Workflow.
- Stage all the changes, commit, then push.
- Go to the Github Repo then click on the Actions tab.
- Go the the "Acquire activation file" action then wait for it to finish.
- On the top right of the "Request manual activation" page click on Artifacts, then download the alf file that was generated.
- Unzip the alf file that was downloaded then upload it to https://license.unity3d.com/manual
- Follow the prompts on that page then downloade the ulf file that it generates.
- Go to the Github Repo then click on the Settings tab, then the Secrets tab.
- Click on Add a new secret then name the secret UNITY_LICENSE
- Copy the contents of the ulf file into the Value input then click on the Add Secret button.
- Create main.yml in .gitignore/workflows with the code from the section Main Workflow
- In the Unity Editor, go to Edit > Project Settings > Editor > Enter Play Mode Settings then enable Enter Play Mode Options (Experimental)
- While Project Settings window is still open, go to Player then change the Company Name and make sure the API Compatibility Level is .NET 4.x
- Stage all the changes, commit, then push.
name: Acquire activation file
on: [push]
jobs:
activation:
name: Request manual activation file 🔑
runs-on: ubuntu-latest
steps:
# Request manual activation file
- name: Request manual activation file
id: getManualLicenseFile
uses: webbertakken/unity-request-manual-activation-file@v1.1
with:
unityVersion: 2019.3.9f1
# Upload artifact (Unity_v20XX.X.XXXX.alf)
- name: Expose as artifact
uses: actions/upload-artifact@v1
with:
name: ${{ steps.getManualLicenseFile.outputs.filePath }}
path: ${{ steps.getManualLicenseFile.outputs.filePath }}
name: Build project
on: [push]
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
jobs:
buildForSomePlatforms:
name: Build for ${{ matrix.targetPlatform }} on version ${{ matrix.unityVersion }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- ./
unityVersion:
- 2019.3.9f1
targetPlatform:
- StandaloneWindows64 # Build a Windows 64-bit standalone.
- StandaloneLinux64 # Build a Linux 64-bit standalone.
- WebGL # WebGL.
steps:
- uses: actions/checkout@v2.1.0
with:
lfs: true
- uses: actions/cache@v1.1.2
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
- uses: webbertakken/unity-builder@v0.12
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v1
with:
name: Build
path: build