@@ -19,19 +19,28 @@ runs:
19
19
20
20
# If no string is provided, assume "all" and set everything to false
21
21
if ([string]::IsNullOrWhiteSpace($deployment_type)) {
22
- "You must provide a deployment type to proceed."
23
- exit 1
22
+ Write-Host "You must provide a deployment type to proceed."
23
+ exit 1
24
24
}
25
25
26
- # First, set all options to false in case a previous run messed with them
27
- jq '.Options |= with_entries(.value = false)' akumina.sitedeployer.config.json > tmpfile
28
- Move-Item -Path tmpfile -Destination akumina.sitedeployer.config.json -Force
29
-
26
+ # Read and parse the JSON file
27
+ $jsonPath = "akumina.sitedeployer.config.json"
28
+ $json = Get-Content -Raw -Path $jsonPath | ConvertFrom-Json
29
+
30
+ # Set all options to false
31
+ $json.Options.PSObject.Properties | ForEach-Object { $_.Value = $false }
32
+
30
33
# Split the input on commas and update the JSON file accordingly
31
34
$deployment_types = $deployment_type -split ","
32
35
foreach ($dt in $deployment_types) {
33
- jq --arg dt $dt '.Options[$dt] = true' akumina.sitedeployer.config.json > tmpfile
34
- Move-Item -Path tmpfile -Destination akumina.sitedeployer.config.json -Force
36
+ if ($json.Options.PSObject.Properties.Name -contains $dt) {
37
+ $json.Options.$dt = $true
38
+ } else {
39
+ Write-Host "Warning: Deployment type '$dt' not found in JSON options."
40
+ }
35
41
}
42
+
43
+ # Save the updated JSON (preserving formatting)
44
+ $json | ConvertTo-Json -Depth 10 | Set-Content -Path $jsonPath -Encoding UTF8
36
45
env :
37
46
DEPLOYMENT_TYPE : ${{ inputs.deployment_type }}
0 commit comments