Skip to content

Commit

Permalink
Update azure-pipelines templates to use functions instead
Browse files Browse the repository at this point in the history
  • Loading branch information
joeltimothyoh committed May 10, 2024
1 parent a134cc4 commit e04e047
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion templates/azure-pipelines/steps/powershell/run-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ steps:
$ErrorActionPreference = 'Stop'
$ErrorView = 'NormalView'
$VerbosePreference = 'Continue'
$MODULE_MANIFEST_PATH = .\build\PSModulePublisher\src\PSModulePublisher\Public\Invoke-Build.ps1
Import-Module .\src\PSModulePublisher\PSModulePublisher.psm1 -Force -Verbose
$MODULE_MANIFEST_PATH = Invoke-Build
### Begin CI-specific code: Set job-scoped variables
echo "##vso[task.setvariable variable=MODULE_MANIFEST_PATH]${MODULE_MANIFEST_PATH}"
### End of CI-specific code
Expand Down
3 changes: 2 additions & 1 deletion templates/azure-pipelines/steps/powershell/run-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ steps:
$ErrorView = 'NormalView'
$VerbosePreference = 'Continue'
"PUBLISH_DRY_RUN: '$($env:PUBLISH_DRY_RUN)'" | Write-Verbose
.\build\PSModulePublisher\src\PSModulePublisher\Public\Invoke-Publish.ps1 -ModuleManifestPath $env:MODULE_MANIFEST_PATH -Repository 'PSGallery' -DryRun:$([System.Convert]::ToBoolean($env:PUBLISH_DRY_RUN))
Import-Module .\src\PSModulePublisher\PSModulePublisher.psm1 -Force -Verbose
Invoke-Publish -ModuleManifestPath $env:MODULE_MANIFEST_PATH -Repository 'PSGallery' -DryRun:$([System.Convert]::ToBoolean($env:PUBLISH_DRY_RUN))
displayName: Publish module
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), ne(variables['MODULE_VERSION'], ''))
env:
Expand Down
3 changes: 2 additions & 1 deletion templates/azure-pipelines/steps/powershell/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ steps:
$ErrorActionPreference = 'Stop'
$ErrorView = 'NormalView'
$VerbosePreference = 'Continue'
.\build\PSModulePublisher\src\PSModulePublisher\Public\Invoke-Test.ps1 -ModuleManifestPath $env:MODULE_MANIFEST_PATH
Import-Module .\src\PSModulePublisher\PSModulePublisher.psm1 -Force -Verbose
Invoke-Test -ModuleManifestPath $env:MODULE_MANIFEST_PATH
displayName: Test module via module's manifest
3 changes: 2 additions & 1 deletion templates/azure-pipelines/steps/pwsh/run-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ steps:
$ErrorActionPreference = 'Stop'
$ErrorView = 'NormalView'
$VerbosePreference = 'Continue'
$MODULE_MANIFEST_PATH = .\build\PSModulePublisher\src\PSModulePublisher\Public\Invoke-Build.ps1
Import-Module .\src\PSModulePublisher\PSModulePublisher.psm1 -Force -Verbose
$MODULE_MANIFEST_PATH = Invoke-Build
### Begin CI-specific code: Set job-scoped variables
echo "##vso[task.setvariable variable=MODULE_MANIFEST_PATH]${MODULE_MANIFEST_PATH}"
### End of CI-specific code
Expand Down
3 changes: 2 additions & 1 deletion templates/azure-pipelines/steps/pwsh/run-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ steps:
$ErrorView = 'NormalView'
$VerbosePreference = 'Continue'
"PUBLISH_DRY_RUN: '$($env:PUBLISH_DRY_RUN)'" | Write-Verbose
.\build\PSModulePublisher\src\PSModulePublisher\Public\Invoke-Publish.ps1 -ModuleManifestPath $env:MODULE_MANIFEST_PATH -Repository 'PSGallery' -DryRun:$([System.Convert]::ToBoolean($env:PUBLISH_DRY_RUN))
Import-Module .\src\PSModulePublisher\PSModulePublisher.psm1 -Force -Verbose
Invoke-Publish -ModuleManifestPath $env:MODULE_MANIFEST_PATH -Repository 'PSGallery' -DryRun:$([System.Convert]::ToBoolean($env:PUBLISH_DRY_RUN))
displayName: Publish module
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), ne(variables['MODULE_VERSION'], ''))
env:
Expand Down
3 changes: 2 additions & 1 deletion templates/azure-pipelines/steps/pwsh/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ steps:
$ErrorActionPreference = 'Stop'
$ErrorView = 'NormalView'
$VerbosePreference = 'Continue'
.\build\PSModulePublisher\src\PSModulePublisher\Public\Invoke-Test.ps1 -ModuleManifestPath $env:MODULE_MANIFEST_PATH
Import-Module .\src\PSModulePublisher\PSModulePublisher.psm1 -Force -Verbose
Invoke-Test -ModuleManifestPath $env:MODULE_MANIFEST_PATH
displayName: Test module via module's manifest

0 comments on commit e04e047

Please sign in to comment.