Skip to content

Commit 130f52f

Browse files
Use regex to match version in MicroBuild workaround (#114549)
Co-authored-by: Ella Hathaway <[email protected]>
1 parent 0a447f8 commit 130f52f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

eng/common/core-templates/steps/install-microbuild.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,18 @@ steps:
9191
script: |
9292
Write-Host "Copying Linux Path"
9393
$MBSIGN_APPFOLDER = '$(MBSIGN_APPFOLDER)'
94-
$MBSIGN_APPFOLDER = $MBSIGN_APPFOLDER -replace '/build', ''
95-
$MBSIGN_APPFOLDER = $MBSIGN_APPFOLDER + '/1.1.1032' + '/build'
94+
$MBSIGN_APPFOLDER = ($MBSIGN_APPFOLDER -replace '/build', '')
95+
96+
$versionRegex = '\d+\.\d+\.\d+'
97+
$package = Get-ChildItem -Path $MBSIGN_APPFOLDER -Directory |
98+
Where-Object { $_.Name -match $versionRegex }
99+
100+
if ($package.Count -ne 1) {
101+
Write-Host "There should be exactly one matching subfolder, but found $($package.Count)."
102+
exit 1
103+
}
104+
105+
$MBSIGN_APPFOLDER = $package[0].FullName + '/build'
96106
$MBSIGN_APPFOLDER | Write-Host
97107
$SignConfigPath = $MBSIGN_APPFOLDER + '/signconfig.xml'
98108
Copy-Item -Path "$(MBSIGN_APPFOLDER)/signconfig.xml" -Destination $SignConfigPath -Force

0 commit comments

Comments
 (0)