Skip to content

Instantly share code, notes, and snippets.

@TomasKostadinov
Created November 9, 2023 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomasKostadinov/e26179585b9cd34e51c78d0c4609a47e to your computer and use it in GitHub Desktop.
Save TomasKostadinov/e26179585b9cd34e51c78d0c4609a47e to your computer and use it in GitHub Desktop.
Set Depyoment Variables in Angular App
[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