Skip to content

Commit

Permalink
Merge pull request #28 from umn-microsoft-automation/version-error
Browse files Browse the repository at this point in the history
Use Import-PowerShellDataFile instead of Test-ModuleManifest to query version, because Test-ModuleManifest will fail if dependencies aren't installed, when they aren't needed at this stage.
  • Loading branch information
FISHMANPET authored Sep 8, 2021
2 parents 785e489 + c3aad54 commit b486e16
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions PSModules/stages/deploy-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ stages:
artifactName: ${{ parameters.ModuleName }}
targetPath: $(Build.ArtifactStagingDirectory)
- powershell: |
$test = (Test-ModuleManifest -Path '$(Build.ArtifactStagingDirectory)\${{ parameters.ModuleName }}\*\${{ parameters.ModuleName }}.psd1')
$test = (Import-PowerShellDataFile -Path '$(Build.ArtifactStagingDirectory)\${{ parameters.ModuleName }}\*\${{ parameters.ModuleName }}.psd1')
if ($test.PrivateData.PSData.Prerelease) {
$version = "$($test.version)-$($test.PrivateData.PSData.Prerelease)"
$version = "$($test.ModuleVersion)-$($test.PrivateData.PSData.Prerelease)"
} else {
$version = $test.Version.ToString()
$version = $test.ModuleVersion
}
Write-Host "INFO [task.setvariable variable=PackageVersion;isOutput=true]$version"
Write-Host "##vso[task.setvariable variable=PackageVersion;isOutput=true]$version"
Expand Down

0 comments on commit b486e16

Please sign in to comment.