blob: 05c49fef9c94a2e74321ca89c07025a3015260ab [file]
$OutputPath = $env:OUTPUT
$Lines = @(
"TARGET $env:TARGET",
"STAMPED $env:STAMPED"
)
$VersionFilePath = $env:VERSION_FILE
if (-not [string]::IsNullOrEmpty($VersionFilePath) -and (Test-Path $VersionFilePath)) {
$Lines += Get-Content -Path $VersionFilePath
}
$InfoFilePath = $env:INFO_FILE
if (-not [string]::IsNullOrEmpty($InfoFilePath) -and (Test-Path $InfoFilePath)) {
$Lines += Get-Content -Path $InfoFilePath
}
# Use .NET to write file to avoid PowerShell encoding/locking quirks
# We use UTF8 without BOM for compatibility with how the bash script writes (and
# what consumers expect).
$Utf8NoBom = New-Object System.Text.UTF8Encoding $False
[System.IO.File]::WriteAllLines($OutputPath, $Lines, $Utf8NoBom)
$Acl = Get-Acl $OutputPath
# We use WorldSid because the "Everyone" name is locale-dependent.
$EveryoneSid = New-Object System.Security.Principal.SecurityIdentifier(
[System.Security.Principal.WellKnownSidType]::WorldSid,
$null
)
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule(
$EveryoneSid,
"Read",
"Allow"
)
$Acl.SetAccessRule($AccessRule)
Set-Acl $OutputPath $Acl
exit 0