Created
November 9, 2023 09:15
-
-
Save TomasKostadinov/e26179585b9cd34e51c78d0c4609a47e to your computer and use it in GitHub Desktop.
Set Depyoment Variables in Angular App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
param ( | |
# [Parameter()] | |
# [string] | |
$CommitHash, | |
$DeploymentTime | |
) | |
$environmentFiles = @( | |
'frontend/src/environments/environment.ts', | |
'frontend/src/environments/environment.staging.ts', | |
'frontend/src/environments/environment.production.ts') | |
foreach($environmentFile in $environmentFiles){ | |
Write-Host "replace CommitHash into $CommitHash and DeploymentTime into $DeploymentTime in $environmentFile was Successfull" | |
Set-Content -Path $environmentFile -Value (Get-Content -Path $environmentFile).Replace('$$commithash$$',"$CommitHash") | |
Set-Content -Path $environmentFile -Value (Get-Content -Path $environmentFile).Replace('$$deploymenttime$$',"$DeploymentTime") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment