aboutsummaryrefslogtreecommitdiff
path: root/ci/compile.ps1
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-06-24 16:46:04 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-06-24 16:46:04 -0400
commita355e12201f50d8f52738d225c270042913030e2 (patch)
tree57cc8e43357ae0cf4cdd72e8f43d5da2357c1f22 /ci/compile.ps1
parent86d6ba0c9869f21b2b16728abf4cb20fcf6ed769 (diff)
ci: Consolidate ci configuration
Diffstat (limited to 'ci/compile.ps1')
-rw-r--r--ci/compile.ps123
1 files changed, 23 insertions, 0 deletions
diff --git a/ci/compile.ps1 b/ci/compile.ps1
new file mode 100644
index 0000000..2858d06
--- /dev/null
+++ b/ci/compile.ps1
@@ -0,0 +1,23 @@
+param([String] $inputDir, [String] $outputDir)
+
+$templateFiles = Get-ChildItem -Path $inputDir -Filter "*-template.json" -File
+
+foreach ($file in $templateFiles) {
+ $baseFilename = $file.BaseName + '.json'
+ $templateFilePath = $file.FullName
+
+ #remove the -template.json suffix
+ $outputFilePath = Join-Path -Path $outputDir -ChildPath $baseFilename.replace("-template","")
+
+ #substitute environment variables for file variables
+ Get-Content $templateFilePath | ForEach-Object {
+ if ($_ -match "\$\{((\w+))\}")
+ {
+ $_ -replace "\$\{(\w+)\}",$([Environment]::GetEnvironmentVariable($Matches[1]))
+ }
+ else
+ {
+ $_
+ }
+ } | Set-Content $outputFilePath
+} \ No newline at end of file