-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
162 lines (127 loc) · 5.02 KB
/
action.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Deploy Landing Zone
description: This workflow deploys and decommissions Landing Zones.
inputs:
solution-path:
description: Path to the Climpr Landing Zones solution directory.
required: true
landing-zone-path:
description: Landing Zone directory path.
required: true
archetypes-path:
description: Archetypes path.
required: true
root-landing-zones-path:
description: Root path for all Landing Zones.
required: true
decommissioned-landing-zones-path:
description: Root path for all decommissioned Landing Zones.
required: true
az-ps-version:
description: The version of Az PS modules to install.
default: 12.4.0
required: false
bicep-version:
description: The version of Bicep to install.
default: v0.30.23
required: false
github-token:
description: The token for the GitHub app that is allowed to create and update repositories in the organization.
required: true
outputs:
new-landing-zone-path:
description: The new Landing Zone directory path
value: ${{ steps.process-landing-zone.outputs.new-landing-zone-path }}
runs:
using: composite
steps:
- name: Set Git config
shell: bash
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Install PS Modules
uses: climpr/install-psmodules@v1
with:
modules: |
Az.ManagementPartner:0.7.4
Az.Subscription:0.11.1
Microsoft.Graph.Authentication:2.24.0
Microsoft.Graph.Groups:2.24.0
Microsoft.Graph.Applications:2.24.0
- name: Install and configure Bicep version
shell: pwsh
run: |
# Download desired Bicep version
curl -Lo bicep https://github.com/Azure/bicep/releases/download/${{ inputs.bicep-version }}/bicep-linux-x64
# Install Bicep
chmod +x ./bicep
sudo mv ./bicep /usr/local/bin/bicep
# Configure az cli to use the externally installed version
az config set bicep.use_binary_from_path=true
- name: Process Landing Zone
uses: azure/powershell@v2
id: process-landing-zone
env:
solutionPath: ${{ inputs.solution-path }}
landingZonePath: ${{ inputs.landing-zone-path }}
archetypesPath: ${{ inputs.archetypes-path }}
rootLandingZonesPath: ${{ inputs.root-landing-zones-path }}
decommissionedLandingZonesPath: ${{ inputs.decommissioned-landing-zones-path }}
actionPath: ${{ github.action_path }}
GH_TOKEN: ${{ inputs.github-token }}
debug: ${{ runner.debug }}
with:
azPSVersion: ${{ inputs.az-ps-version }}
inlineScript: |
#* Run scripts
#* Set debug preference from runner configuration
$DebugPreference = [bool]$env:debug ? "Continue" : "SilentlyContinue"
#* Set-PartnerId.ps1
echo "::group::Set-PartnerId"
& "$($env:actionPath)/src/Set-PartnerId.ps1" -PartnerId "6100086"
echo "::endgroup::"
#* Deploy-GitHubRepository.ps1
echo "::group::Deploy-GitHubRepository"
$param = @{
LandingZonePath = $env:landingZonePath
SolutionPath = $env:solutionPath
}
& "$($env:actionPath)/src/Deploy-GitHubRepository.ps1" @param
echo "::endgroup::"
#* Deploy-AzureLandingZone.ps1
echo "::group::Deploy-AzureLandingZone"
$param = @{
LandingZonePath = $env:landingZonePath
ArchetypesPath = $env:archetypesPath
SolutionPath = $env:solutionPath
}
& "$($env:actionPath)/src/Deploy-AzureLandingZone.ps1" @param
echo "::endgroup::"
#* Remove-AzureLandingZone.ps1
echo "::group::Remove-AzureLandingZone"
$param = @{
LandingZonePath = $env:landingZonePath
ArchetypesPath = $env:archetypesPath
SolutionPath = $env:solutionPath
}
& "$($env:actionPath)/src/Remove-AzureLandingZone.ps1" @param
echo "::endgroup::"
#* Remove-GitHubRepository.ps1
echo "::group::Remove-GitHubRepository"
$param = @{
LandingZonePath = $env:landingZonePath
SolutionPath = $env:solutionPath
}
& "$($env:actionPath)/src/Remove-GitHubRepository.ps1" @param
echo "::endgroup::"
#* Move-LandingZoneDirectory.ps1
echo "::group::Move-LandingZoneDirectory"
$param = @{
LandingZonePath = $env:landingZonePath
RootLandingZonesPath = $env:rootLandingZonesPath
DecommissionedLandingZonesPath = $env:decommissionedLandingZonesPath
SolutionPath = $env:solutionPath
}
$newLandingZonePath = & "$($env:actionPath)/src/Move-LandingZoneDirectory.ps1" @param
Write-Output "new-landing-zone-path=$newLandingZonePath" >> $env:GITHUB_OUTPUT
echo "::endgroup::"