Last active
May 28, 2021 19:22
-
-
Save tclancy/ffbf3eadace913de9ce357566ae7506f to your computer and use it in GitHub Desktop.
Microsoft Dynamics Power Apps Azure Build Pipeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Because there's nothing easily google-able for how to do this, here's | |
# a script to show the "basics" and create a permanent memorial to the | |
# week of my life it took to learn this | |
# 1. Install the Power Apps CLI via Powershell | |
# 2. Install node | |
# 3. Add node and install pcf-scripts (https://www.npmjs.com/package/pcf-scripts) | |
# 4. Run pcf scripts | |
# 5. Run msbuild on project file(s) | |
# 6. Run deployment Powershell script which looks like this: | |
# Install-Module Microsoft.Xrm.Data.PowerShell -Scope CurrentUser -Force | |
# Import-Module Microsoft.Xrm.Data.Powershell | |
# $conn = Connect-CrmOnline -ClientSecret $Env:CLIENT_SECRET -OAuthClientId $Env:CLIENT_ID ` | |
# -ServerUrl "https://alliancefunding$Env:TARGET_ENVIRONMENT.crm.dynamics.com" | |
# Import-CrmSolution -conn $conn -SolutionFilePath "$ENV:BUILD_SOURCESDIRECTORY\MyComponentName\Solution\bin\Debug\Solution.zip" ` | |
# -Verbose -OverwriteUnManagedCustomizations | |
trigger: | |
- master | |
pool: | |
vmImage: windows-latest | |
steps: | |
- task: PowerShell@2 | |
displayName: 'Download and install Power Apps CLI' | |
inputs: | |
targetType: 'inline' | |
script: | | |
Invoke-WebRequest -Uri 'https://aka.ms/PowerAppsCLI' -MaximumRedirection 1 -OutFile 'installer.msi' | |
Start-Process 'installer.msi' -ArgumentList '/q' -Wait | |
- task: NodeTool@0 | |
inputs: | |
versionSpec: '16.x' | |
- task: Npm@1 | |
inputs: | |
command: 'install' | |
workingDir: '.' | |
- task: Npm@1 | |
displayName: 'Run pcf scripts' | |
inputs: | |
command: 'custom' | |
customCommand: 'run build' | |
workingDir: '.' | |
- task: MSBuild@1 | |
inputs: | |
solution: '**/*.cdsproj' | |
msbuildArguments: '/t:build /restore' | |
- task: PowerShell@2 | |
displayName: 'Deploy components to $(TARGET_ENVIRONMENT) environment' | |
inputs: | |
targetType: 'filePath' | |
filePath: build.ps1 | |
env: | |
CLIENT_ID: $(CLIENT_ID) | |
CLIENT_SECRET: $(CLIENT_SECRET) | |
TARGET_ENVIRONMENT: $(TARGET_ENVIRONMENT) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment