generated from microsoft/AL-Go-PTE
-
Notifications
You must be signed in to change notification settings - Fork 9
97 lines (85 loc) · 3.56 KB
/
PushPowerPlatformChanges.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: " Push Power Platform changes"
on:
workflow_dispatch:
inputs:
environment:
description: Environment to push changes to
required: true
solutionFolder:
description: Folder name of the Power Platform solution (leave empty to use AL-Go setting)
required: false
permissions:
contents: read
defaults:
run:
shell: powershell
jobs:
PushChanges:
runs-on: [windows-latest]
name: Push changes to ${{ inputs.environment }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialize the workflow
id: init
uses: microsoft/AL-Go/Actions/WorkflowInitialize@6a9ef0c91e5b54d0fd3abb3d4495417a1db28f17
with:
shell: powershell
eventId: "DO0103"
- name: EnvName
env:
_environment: ${{ inputs.environment }}
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
# Environment names can contains spaces and tags (like (PROD) etc. We need to remove them to get the correct environment name)
$envName = "$env:_environment".Split(' ')[0]
Add-Content -encoding utf8 -Path $env:GITHUB_ENV -Value "envName=$envName"
- name: Read settings
uses: microsoft/AL-Go/Actions/ReadSettings@6a9ef0c91e5b54d0fd3abb3d4495417a1db28f17
with:
shell: powershell
get: powerPlatformSolutionFolder
- name: Read secrets
id: ReadSecrets
uses: microsoft/AL-Go/Actions/ReadSecrets@6a9ef0c91e5b54d0fd3abb3d4495417a1db28f17
with:
shell: powershell
gitHubSecrets: ${{ toJson(secrets) }}
getSecrets: '${{ env.envName }}-AuthContext,${{ env.envName }}_AuthContext,AuthContext'
- name: Determine Deployment Environments
id: DetermineDeploymentEnvironments
uses: microsoft/AL-Go/Actions/DetermineDeploymentEnvironments@6a9ef0c91e5b54d0fd3abb3d4495417a1db28f17
env:
GITHUB_TOKEN: ${{ github.token }}
with:
shell: powershell
getEnvironments: ${{ inputs.environment }}
type: 'All'
- name: Set Power Platform solution folder
env:
_solutionFolder: ${{ inputs.solutionFolder }}
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$solutionFolder = $env:_solutionFolder
if ($solutionFolder -eq '') {
Write-Host "Solution folder is not provided. Taking the folder from AL-Go settings"
$solutionFolder = $env:powerPlatformSolutionFolder
}
Write-Host "Solution folder: $solutionFolder"
Add-Content -encoding utf8 -Path $env:GITHUB_ENV -Value "solutionFolder=$solutionFolder"
- name: Export and push changes to Power Platform
uses: microsoft/AL-Go/Actions/DeployPowerPlatform@6a9ef0c91e5b54d0fd3abb3d4495417a1db28f17
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
with:
shell: powershell
environmentName: ${{ inputs.environment }}
solutionFolder: ${{ env.solutionFolder }}
deploymentEnvironmentsJson: ${{ steps.DetermineDeploymentEnvironments.outputs.deploymentEnvironmentsJson }}
- name: Finalize the workflow
if: always()
uses: microsoft/AL-Go/Actions/WorkflowPostProcess@6a9ef0c91e5b54d0fd3abb3d4495417a1db28f17
with:
shell: powershell
eventId: "DO0103"
telemetryScopeJson: ${{ steps.init.outputs.telemetryScopeJson }}