98 lines (86 loc) · 3.63 KB
/
solution-export-unpack-commit.yml
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
98
name: solution-export-unpack-commit
# Export solution from DEV environment
# unpack it, commit and push the changes
on:
workflow_dispatch:
inputs:
solution_name:
description: "name of the Solution in Dataverse environment"
required: true
default: pvaalm
environment_url:
description: "http endpoint of your Dataverse environment"
required: true
default: "https://[your-env].crm.dynamics.com"
source_branch:
description: "source branch"
required: true
default: main
branch_to_create:
description: "branch to create"
required: false
commit_message:
description: "message to provide for the commit"
required: true
jobs:
export-from-dev:
runs-on: ubuntu-latest
env:
RUNNER_DEBUG: 1
solution_export_folder: solution-export-temp
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.source_branch }}
- name: create new git branch
if: github.event.inputs.branch_to_create != ''
run: |
git checkout -b ${{ github.event.inputs.branch_to_create }} ${{ github.event.inputs.source_branch }}
- name: export-unmanaged-solution action
uses: microsoft/powerplatform-actions/export-solution@0.4.3
with:
environment-url: ${{ github.event.inputs.environment_url}}
app-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
tenant-id: ${{ secrets.TENANT_ID }}
solution-name: ${{ github.event.inputs.solution_name }}
solution-output-file: ${{ runner.temp }}/${{ env.solution_export_folder }}/${{ github.event.inputs.solution_name }}.zip
- name: export-managed-solution action
uses: microsoft/powerplatform-actions/export-solution@0.4.3
with:
environment-url: ${{ github.event.inputs.environment_url}}
app-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
tenant-id: ${{ secrets.TENANT_ID }}
solution-name: ${{ github.event.inputs.solution_name }}
solution-output-file: ${{ runner.temp }}/${{ env.solution_export_folder }}/${{ github.event.inputs.solution_name }}_managed.zip
managed: true
- name: unpack-solution action
uses: microsoft/powerplatform-actions/unpack-solution@0.4.3
with:
solution-file: ${{ runner.temp }}/${{ env.solution_export_folder }}/${{ github.event.inputs.solution_name }}.zip
solution-folder: src/${{ github.event.inputs.solution_name }}/SolutionPackage
solution-type: "Both"
overwrite-files: true
- name : clear out solution version number
shell: pwsh
run: |
Get-ChildItem -Path "src/${{ github.event.inputs.solution_name }}/SolutionPackage/**/Solution.xml" |
ForEach-Object {
(Get-Content $_.FullName) `
-replace '<Version>[\s\S]*?<\/Version>', '<Version>0.0.0.0</Version>' |
Out-File $_.FullName
}
- name: commit changes
run: |
git config --global user.name ${{ github.actor }}
git add --all
git commit -am "${{ github.event.inputs.commit_message }}"
- name: push to ${{ github.event.inputs.source_branch }}
if: github.event.inputs.branch_to_create == ''
run: |
git push
- name: push to ${{ github.event.inputs.branch_to_create }}
if: github.event.inputs.branch_to_create != ''
run: |
git push --set-upstream origin ${{ github.event.inputs.branch_to_create }}