forked from devkeydet/pva-alm
-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (100 loc) · 4.41 KB
/
delete-and-import-unmanaged-solution.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: delete-and-import-unmanaged-solution
on:
workflow_dispatch:
inputs:
solution_name:
description: "name of the Solution in Dataverse environment"
required: true
default: yoursolutionname
environment_url:
description: "http endpoint of your Dataverse environment"
required: true
default: "https://[your-env].crm[x].dynamics.com"
ref:
description: "the ref (branch, commit, tag) you want to import"
required: true
default: "main"
jobs:
# Needs it's own job in order for delete-build-deploy-solution->environment value to be used.
get-environment-from-domain:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: get-subdomain
id: get-subdomain
uses: ./.github/actions/get-subdomain
with:
url: ${{ github.event.inputs.environment_url }}
outputs:
subdomain: ${{ steps.get-subdomain.outputs.subdomain }}
delete-build-deploy-solution:
runs-on: ubuntu-latest
needs: get-environment-from-domain
environment: ${{ needs.get-environment-from-domain.outputs.subdomain }}
steps:
- uses: actions/checkout@v2
- name: set-pac-path
uses: ./.github/actions/set-pac-path
# Some Dataverse calls in this workflow cannot run async. Therefore, they will fail
# If someone runs more than one workflow against the environment at the same time.
# To prevent this, wait for other workflows queued up to finish before continuing
- name: queue-environment
id: queue-environment
uses: devkeydet/action-environment-queue@v1
with:
environment: ${{ needs.get-environment-from-domain.outputs.subdomain }}
- name: delete-unmanaged-solution-and-components-from-environment
uses: ./.github/actions/delete-unmanaged-solution-and-components-from-environment
with:
solution_name: ${{ github.event.inputs.solution_name }}
environment_url: ${{ github.event.inputs.environment_url }}
tenant_id: ${{ secrets.TENANT_ID }}
client_id: ${{ secrets.CLIENT_ID }}
client_secret: ${{ secrets.CLIENT_SECRET }}
- name: build-solution
uses: ./.github/actions/build-solution
with:
ref: ${{ github.event.inputs.ref }}
solution_name: ${{ github.event.inputs.solution_name }}
solution_package_source: "src/${{ github.event.inputs.solution_name }}/SolutionPackage"
dev_build: true
- name: deploy-solution
uses: ./.github/actions/deploy-solution
with:
environment_url: ${{ github.event.inputs.environment_url }}
solution_name: ${{ github.event.inputs.solution_name }}
environment: ${{ needs.get-environment-from-domain.outputs.subdomain }}
unmanaged: true
secrets: ${{ toJSON(secrets) }}
- name: publish-customizations
uses: microsoft/powerplatform-actions/publish-solution@latest
with:
environment-url: ${{ github.event.inputs.environment_url}}
app-id: ${{ secrets.CLIENT_ID }}
client-secret: ${{ secrets.CLIENT_SECRET }}
tenant-id: ${{ secrets.TENANT_ID }}
import-data-and-turn-on-flows:
runs-on: windows-2022
needs: [get-environment-from-domain, delete-build-deploy-solution]
environment: ${{ needs.get-environment-from-domain.outputs.subdomain }}
steps:
- uses: actions/checkout@v2
- id: import-configuration-migration-data-if-exists
name: import-configuration-migration-data-if-exists
uses: ./.github/actions/import-configuration-migration-data-if-exists
with:
environment_url: ${{ github.event.inputs.environment_url }}
solution_name: ${{ github.event.inputs.solution_name }}
tenant_id: ${{ secrets.TENANT_ID }}
app_id: ${{ secrets.CLIENT_ID }}
client_secret: ${{ secrets.CLIENT_SECRET }}
environment: ${{ needs.get-environment-from-domain.outputs.subdomain }}
- id: turn-on-flows-impersonation
uses: ./.github/actions/turn-on-flows-impersonation
with:
environment_url: ${{ github.event.inputs.environment_url }}
solution_name: ${{ github.event.inputs.solution_name }}
tenant_id: ${{ secrets.TENANT_ID }}
app_id: ${{ secrets.CLIENT_ID }}
client_secret: ${{ secrets.CLIENT_SECRET }}
secrets: ${{ toJSON(secrets) }}