Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
vmImage: 'windows-2019'
# make sure you have set variables for followings at AzureDevOps Pipeline Variable configuration UI.
# https://dev.azure.com/YOUR_ORG/YOUR_PROJECT/_apps/hub/ms.vss-ciworkflow.build-ci-hub?_a=edit-build-definition&id=YOUR_ID&view=Tab_Variables
# variables:
#unity.username: YOUR_USER_NAME_AS_SECRET
#unity.password: YOUR_USER_PASSWORD_AS_SECRET
#unity.serialkey: YOUR_UNITY_SERIALKEY_AS_SECRET
steps:
- checkout: self
clean: true
fetchDepth: 1
lfs: false
# YAML Build not support output variable, so it won't work on YAML at current 10/June/2019.
# refer: https://developercommunity.visualstudio.com/content/problem/335706/output-variable-set-in-the-vsts-task-does-not-show.html
# use name instead to reference output variable.
- task: DinomiteStudios.64e90d50-a9c0-11e8-a356-d3eab7857116.custom-unity-get-project-version-task.UnityGetProjectVersionTask@1
displayName: 'Unity Get Project Version'
name: unitygetprojectversion
- pwsh: Install-Module -Name UnitySetup -AllowPrerelease -Scope CurrentUser -Force
displayName: 'Install UnitySetup Module'
failOnStderr: true
- pwsh: Install-UnitySetupInstance -Installers (Find-UnitySetupInstaller -Version '$(unitygetprojectversion.projectVersion)' -Components Windows,UWP_IL2CPP) -Verbose
displayName: 'Install Unity'
failOnStderr: true
- task: DinomiteStudios.64e90d50-a9c0-11e8-a356-d3eab7857116.custom-unity-activate-license-task.UnityActivateLicenseTask@1
displayName: 'Unity Activate License'
inputs:
username: '$(unity.username)'
password: '$(unity.password)'
serial: '$(unity.serialkey)'
- script: dotnet tool install --global UnityBuildRunner
displayName: 'Install UnityBuildRunner'
- script: |
set UnityPath=C:\Program Files\Unity\Hub\Editor\$(unitygetprojectversion.projectVersion)\Editor\Unity.exe
UnityBuildRunner -quit -batchmode -projectPath $(Build.Repository.LocalPath) -buildTarget WSAPlayer -logfile $(Build.ArtifactStagingDirectory)\Editor.log -executeMethod Microsoft.MixedReality.Toolkit.Build.Editor.UnityPlayerBuildTools.StartCommandLineBuild
displayName: 'Unity Build'
# Azure DevOps Hosted Agent won't install Windows 10 SDK version 10.0.18362.0.
# Therefore MRTKv2 could not refer some new introduced windows 10 SDK API.
# Fix: install Windows 10 SDK 10.0.18362 before unity build.
# - task: DinomiteStudios.64e90d50-a9c0-11e8-a356-d3eab7857116.custom-unity-build-task.UnityBuildTask@2
# displayName: 'Unity Build WindowsStoreApps'
# inputs:
# buildTarget: WindowsStoreApps
# commandLineArgumentsMode: custom
# customCommandLineArguments: '-ExecuteMethod Microsoft.MixedReality.Toolkit.Build.Editor.UnityPlayerBuildTools.StartCommandLineBuild -logfile $(Build.ArtifactStagingDirectory)/Editor.log'
# continueOnError: true
- pwsh: Get-ChildItem -Recurse
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline Artifact'
inputs:
artifactName: 'unity_build_log'
targetPath: '$(Build.ArtifactStagingDirectory)'
# if you want to build locally
#- task: PublishPipelineArtifact@0
# displayName: 'Publish Pipeline Artifact'
# inputs:
# artifactName: 'sln'
# targetPath: 'Builds/WSAPlayer'
- task: NuGetToolInstaller@1
displayName: 'Use NuGet'
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: 'Builds/WSAPlayer/*.sln'
- task: MSBuild@1
displayName: 'Build solution'
inputs:
solution: 'Builds/WSAPlayer'
platform: x64
configuration: Release
msbuildArguments: '/P:PlatformToolset=v142;AppxBundle=Always;AppxBundlePlatforms=x64'
- task: PublishPipelineArtifact@0
displayName: 'Publish Pipeline Artifact'
inputs:
artifactName: 'apppackages'
targetPath: 'Builds/WSAPlayer/AppPackages'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.