From 73540faeb90e1461f3e4d489b1e415f2bbf890f0 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Tue, 9 Jun 2020 22:33:48 -0400 Subject: [PATCH 01/13] Update Build Paths --- ZertoApiWrapper.build.ps1 | 60 +++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 25 deletions(-) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index 853d110..cc0b33f 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -1,23 +1,24 @@ #Requires -Modules 'InvokeBuild' $version = "{0}" -f $(Get-Content .\version.txt) +$moduleOutPath = "{0}\temp\{1}\ZertoApiWrapper" -f $BuildRoot, $version #Define the default task task . CreateArtifacts #Region - Helper Functions -function ImportSourceModule() { +function ImportSourceModule { If (Get-Module -Name ZertoApiWrapper) { Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop } Import-Module "$BuildRoot\ZertoApiWrapper\ZertoApiWrapper.psd1" -ErrorAction Stop } -function ImportBuiltModule() { +function ImportBuiltModule { If (Get-Module -Name ZertoApiWrapper) { Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop } - Import-Module "$BuildRoot\temp\ZertoApiWrapper.psd1" -ErrorAction Stop + Import-Module ("{0}\ZertoApiWrapper.psd1" -f $moduleOutPath) -ErrorAction Stop } #EndRegion @@ -65,7 +66,7 @@ task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, { task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, { $scriptAnalyzerParams = @{ - Path = "$BuildRoot\temp\" + Path = $moduleOutPath Severity = @('Error', 'Warning') Recurse = $true Verbose = $false @@ -82,10 +83,10 @@ task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, { #Region - Clean Operations task CleanTemp { - if (-not $(Test-Path "$BuildRoot\temp")) { - New-Item -Path $BuildRoot -Name "temp" -ItemType "Directory" + if (-not $(Test-Path $moduleOutPath)) { + New-Item -Path $moduleOutPath -ItemType "Directory" } - Remove-Item -Recurse -Path "$BuildRoot\temp\*" + Remove-Item -Recurse -Path ("{0}\*" -f $moduleOutPath) } task CleanPublish { @@ -116,7 +117,7 @@ task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, { #Region - Build Help System $buildMamlParams = @{ Inputs = { Get-ChildItem docs\*.md } - Outputs = "$BuildRoot\temp\en-us\ZertoApiWrapper-help.xml" + Outputs = "{0}\en-us\ZertoApiWrapper-help.xml" -f $moduleOutPath } task BuildMamlHelp CheckPlatyPSInstalled, { @@ -126,8 +127,8 @@ task BuildMamlHelp CheckPlatyPSInstalled, { platyPS\New-ExternalHelp .\docs -Force -OutputPath $buildMamlParams.Outputs } -task UpdateMarkdownHelp CheckPlatyPSInstalled, { - ImportSourceModule +task UpdateMarkdownHelp quickBuild, CheckPlatyPSInstalled, { + ImportBuiltModule Update-MarkdownHelpModule -Path docs -AlphabeticParamsOrder } #EndRegion @@ -138,7 +139,7 @@ task CreatePsd1ForRelease CleanTemp, { $releaseNotes = "Please review the [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/{0}) on GitHub." -f $version $ManifestParams = @{ - Path = "$BuildRoot\temp\ZertoApiWrapper.psd1" + Path = "{0}\ZertoApiWrapper.psd1" -f $moduleOutPath RootModule = 'ZertoApiWrapper.psm1' ModuleVersion = $version GUID = '4c0b9e17-141b-4dd5-8549-fb21cccaa325' @@ -161,25 +162,25 @@ task CreatePsd1ForRelease CleanTemp, { task CreatePsm1ForRelease CreatePsd1ForRelease, { $emptyLine = "" - $psm1Path = "$BuildRoot\temp\ZertoApiWrapper.psm1" + $psm1Path = "{0}\ZertoApiWrapper.psm1" -f $moduleOutPath $lines = '#------------------------------------------------------------#' $Private = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Private\*.ps1 -ErrorAction Stop ) $Public = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Public\*.ps1 -ErrorAction Stop ) - Add-Content -Path $psm1Path -Value $lines - Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#" - Add-Content -Path $psm1Path -Value $lines - Add-Content -Path $psm1Path -Value $emptyLine + Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8' + Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#" -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8' foreach ($file in $private) { - Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) - Add-Content -Path $psm1Path -Value $emptyLine + Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8' } - Add-Content -Path $psm1Path -Value $lines - Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#" - Add-Content -Path $psm1Path -Value $lines - Add-Content -Path $psm1Path -Value $emptyLine + Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8' + Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#" -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8' foreach ($file in $public) { - Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) - Add-Content -Path $psm1Path -Value $emptyLine + Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8' + Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8' } # Add-Content -Path $psm1Path -Value $emptyLine # Add-Content -Path $psm1Path -Value "Export-ModuleMember -Function $exportString" @@ -188,7 +189,7 @@ task CreatePsm1ForRelease CreatePsd1ForRelease, { #Region - Artifacts \ Publish # Full Build Process - No Publishing -task CreateArtifacts CleanPublish, CleanTemp, AnalyzeSourceFiles, SourceFileTests, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, { +task CreateArtifacts CleanPublish, CleanTemp, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, { if (-not $(Test-Path "$BuildRoot\publish")) { New-Item -Path $BuildRoot -Name "publish" -ItemType Directory } @@ -201,3 +202,12 @@ task CreateArtifacts CleanPublish, CleanTemp, AnalyzeSourceFiles, SourceFileTest Copy-Item "$BuildRoot\build.ps1" "$BuildRoot\publish\build.ps1" } #EndRegion + +task build CleanPublish, CleanTemp, CreatePsm1ForRelease, AnalyzeBuiltFiles, BuiltFileTests, CreateArtifacts +task quickBuild CleanPublish, CleanTemp, CreatePsm1ForRelease, AnalyzeBuiltFiles, { + Get-Module -Name ZertoApiWrapper | Remove-Module -Force + ImportBuiltModule +} +task release quickBuild, { + Publish-Module -Path $moduleOutPath -NuGetApiKey "1234" -WhatIf +} From 32403ec3e3abe29204327d9d8cf5068df5394c72 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 09:41:37 -0400 Subject: [PATCH 02/13] Update build script with params --- build.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 9ce90cf..2f2c873 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,3 +1,5 @@ +param([validateSet("build", "release")]$operation = "build") + # Bootstrap the environment $null = Get-PackageProvider -Name NuGet -ForceBootstrap @@ -11,6 +13,7 @@ Invoke-PSDepend ` -Force ` -Import ` -Install ` - -Tags 'Bootstrap' + -Tags 'Bootstrap' ` + -ErrorAction Continue -Invoke-Build . +Invoke-Build $operation From 925ecaf2247a049e85f52bf514be486c0ed9de1c Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 09:42:17 -0400 Subject: [PATCH 03/13] Update default build operation --- ZertoApiWrapper.build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index cc0b33f..9e2d883 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -4,7 +4,7 @@ $version = "{0}" -f $(Get-Content .\version.txt) $moduleOutPath = "{0}\temp\{1}\ZertoApiWrapper" -f $BuildRoot, $version #Define the default task -task . CreateArtifacts +task . build #Region - Helper Functions function ImportSourceModule { From e90d2a23cc52f6ccdd0e978c5c91697aaeb2f9d7 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 09:42:41 -0400 Subject: [PATCH 04/13] Update tests to only show failed --- ZertoApiWrapper.build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index 9e2d883..788ed57 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -108,7 +108,7 @@ task SourceFileTests CheckPesterInstalled, { task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, { ImportBuiltModule $testResultsFile = "$BuildRoot\Tests\BuiltTestResults.xml" - $script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Fails + $script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Failed $FailureMessage = '{0} Unit test(s) failed. Aborting build' -f $results.FailedCount Assert ($results.FailedCount -eq 0) $FailureMessage } From c7c3428dd5cb0b48ccbe70e045d48e9cd465aa20 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 09:43:03 -0400 Subject: [PATCH 05/13] Update release task to use full build process --- ZertoApiWrapper.build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index 788ed57..8069b4c 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -208,6 +208,6 @@ task quickBuild CleanPublish, CleanTemp, CreatePsm1ForRelease, AnalyzeBuiltFiles Get-Module -Name ZertoApiWrapper | Remove-Module -Force ImportBuiltModule } -task release quickBuild, { +task release build, { Publish-Module -Path $moduleOutPath -NuGetApiKey "1234" -WhatIf } From 906d35186fd6569920bc1d7dd560f953305ae995 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 09:43:32 -0400 Subject: [PATCH 06/13] Update Required Module Versions --- ZertoApiWrapper.Depend.psd1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ZertoApiWrapper.Depend.psd1 b/ZertoApiWrapper.Depend.psd1 index 820e1f4..e3f8356 100644 --- a/ZertoApiWrapper.Depend.psd1 +++ b/ZertoApiWrapper.Depend.psd1 @@ -7,7 +7,7 @@ SkipPublisherCheck = $true } Target = 'CurrentUser' - Version = '5.5.11' + Version = '5.6.0' Tags = 'Bootstrap' } @@ -31,7 +31,7 @@ SkipPublisherCheck = $true } Target = 'CurrentUser' - Version = '1.18.3' + Version = '1.19.0' Tags = 'Bootstrap' } From aab22cf266e576168e60ccaea1ab155962061c29 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 09:53:01 -0400 Subject: [PATCH 07/13] Add Branch to Auto-Build --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e5c7180..6cb32e3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,6 +11,7 @@ trigger: include: - master - PowerShellBackPort + - Refactor-Build # Trigger CI on pull requests to master and develop branches pr: From a55b0cd46734e4f220a7ec62bd0ac9abe9f27221 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 09:58:32 -0400 Subject: [PATCH 08/13] Remove SourceFileTests publish --- azure-pipelines.yml | 149 ++++++++++++++++++-------------------------- 1 file changed, 60 insertions(+), 89 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6cb32e3..3a21d03 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,26 +25,18 @@ jobs: pool: vmImage: windows-latest steps: - # Run build.ps1 script in PowerShell Core - - powershell: | - .\build.ps1 -Verbose - displayName: 'Build and Test' - # Upload test results to Azure Pipeline - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/SourceTestResults.xml' - testRunTitle: 'PS_Win2016_Source' - displayName: 'Publish Test Results' - condition: always() - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/BuiltTestResults.xml' - testRunTitle: 'PS_Win2016_Built' - displayName: 'Publish Test Results' - condition: always() - + # Run build.ps1 script in PowerShell Core + - powershell: | + .\build.ps1 -Verbose + displayName: "Build and Test" + # Upload test results to Azure Pipeline + - task: PublishTestResults@2 + inputs: + testRunner: "NUnit" + testResultsFiles: "**/BuiltTestResults.xml" + testRunTitle: "PS_Win2016_Built" + displayName: "Publish Test Results" + condition: always() # Windows PowerShell Core Build Job - job: Build_PSCore_Windows @@ -53,25 +45,18 @@ jobs: pool: vmImage: windows-latest steps: - # Run build.ps1 script in PowerShell Core - - pwsh: | - .\build.ps1 -Verbose - displayName: 'Build and Test' - # Upload test results to Azure Pipeline - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/SourceTestResults.xml' - testRunTitle: 'PSCore_Win2016_Source' - displayName: 'Publish Test Results' - condition: always() - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/BuiltTestResults.xml' - testRunTitle: 'PSCore_Win2016_Built' - displayName: 'Publish Test Results' - condition: always() + # Run build.ps1 script in PowerShell Core + - pwsh: | + .\build.ps1 -Verbose + displayName: "Build and Test" + # Upload test results to Azure Pipeline + - task: PublishTestResults@2 + inputs: + testRunner: "NUnit" + testResultsFiles: "**/BuiltTestResults.xml" + testRunTitle: "PSCore_Win2016_Built" + displayName: "Publish Test Results" + condition: always() # Linux Build Job - job: Build_PSCore_Ubuntu @@ -80,37 +65,30 @@ jobs: pool: vmImage: ubuntu-latest steps: - # Run build.ps1 script in PowerShell Core - - pwsh: | - .\build.ps1 -verbose - displayName: 'Build and Test' - # Upload test results to Azure Pipeline - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/SourceTestResults.xml' - testRunTitle: 'PSCore_Ubuntu_Source' - displayName: 'Publish Test Results' - condition: always() - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/BuiltTestResults.xml' - testRunTitle: 'PSCore_Ubuntu_Built' - displayName: 'Publish Test Results' - condition: always() - - task: PublishPipelineArtifact@0 - displayName: 'Publish compiled module Artifact' - inputs: - artifactName: 'ZertoApiWrapper' - targetPath: ./temp - condition: always() - - task: PublishPipelineArtifact@0 - displayName: 'Publish Data' - inputs: - artifactName: 'ReleaseData' - targetPath: ./publish - condition: always() + # Run build.ps1 script in PowerShell Core + - pwsh: | + .\build.ps1 -verbose + displayName: "Build and Test" + # Upload test results to Azure Pipeline + - task: PublishTestResults@2 + inputs: + testRunner: "NUnit" + testResultsFiles: "**/BuiltTestResults.xml" + testRunTitle: "PSCore_Ubuntu_Built" + displayName: "Publish Test Results" + condition: always() + - task: PublishPipelineArtifact@0 + displayName: "Publish compiled module Artifact" + inputs: + artifactName: "ZertoApiWrapper" + targetPath: ./temp + condition: always() + - task: PublishPipelineArtifact@0 + displayName: "Publish Data" + inputs: + artifactName: "ReleaseData" + targetPath: ./publish + condition: always() # MacOS Build Job - job: Build_PSCore_MacOS @@ -119,22 +97,15 @@ jobs: pool: vmImage: macOS-latest steps: - # Run build.ps1 script in PowerShell Core - - pwsh: | - .\build.ps1 -verbose - displayName: 'Build and Test' - # Upload test results to Azure Pipeline - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/SourceTestResults.xml' - testRunTitle: 'PSCore_MacOS1013_Source' - displayName: 'Publish Test Results' - condition: always() - - task: PublishTestResults@2 - inputs: - testRunner: 'NUnit' - testResultsFiles: '**/BuiltTestResults.xml' - testRunTitle: 'PSCore_MacOS1013_Built' - displayName: 'Publish Test Results' - condition: always() + # Run build.ps1 script in PowerShell Core + - pwsh: | + .\build.ps1 -verbose + displayName: "Build and Test" + # Upload test results to Azure Pipeline + - task: PublishTestResults@2 + inputs: + testRunner: "NUnit" + testResultsFiles: "**/BuiltTestResults.xml" + testRunTitle: "PSCore_MacOS1013_Built" + displayName: "Publish Test Results" + condition: always() From 9ad9cb7f1e4624ec98b6efeded65f032a8820875 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 12:20:00 -0400 Subject: [PATCH 09/13] Update Build Path for Artifact Utilization --- ZertoApiWrapper.build.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index 8069b4c..f41483f 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -1,7 +1,7 @@ #Requires -Modules 'InvokeBuild' $version = "{0}" -f $(Get-Content .\version.txt) -$moduleOutPath = "{0}\temp\{1}\ZertoApiWrapper" -f $BuildRoot, $version +$moduleOutPath = "{0}\temp\ZertoApiWrapper\{1}" -f $BuildRoot, $version #Define the default task task . build @@ -193,7 +193,8 @@ task CreateArtifacts CleanPublish, CleanTemp, AnalyzeBuiltFiles, BuiltFileTests, if (-not $(Test-Path "$BuildRoot\publish")) { New-Item -Path $BuildRoot -Name "publish" -ItemType Directory } - Compress-Archive -Path .\temp\* -DestinationPath .\publish\ZertoApiWrapper.zip + $CompressionPath = Split-Path -Path $moduleOutPath -Parent + Compress-Archive -Path $CompressionPath -DestinationPath .\publish\ZertoApiWrapper.zip #ImportBuiltModule #(Get-Module ZertoApiWrapper).ReleaseNotes | Add-Content .\publish\release-notes.txt #(Get-Module ZertoApiWrapper).Version.ToString() | Add-Content .\publish\release-version.txt From 512d5bbd749bb7fcf1ff623f79c6d87f4d8b87ee Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 15:52:59 -0400 Subject: [PATCH 10/13] Update Publish Location --- ZertoApiWrapper.build.ps1 | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index f41483f..593e376 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -1,7 +1,7 @@ #Requires -Modules 'InvokeBuild' $version = "{0}" -f $(Get-Content .\version.txt) -$moduleOutPath = "{0}\temp\ZertoApiWrapper\{1}" -f $BuildRoot, $version +$moduleOutPath = "{0}\publish\ZertoApiWrapper" -f $BuildRoot #Define the default task task . build @@ -82,17 +82,13 @@ task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, { #EndRegion #Region - Clean Operations -task CleanTemp { - if (-not $(Test-Path $moduleOutPath)) { - New-Item -Path $moduleOutPath -ItemType "Directory" - } - Remove-Item -Recurse -Path ("{0}\*" -f $moduleOutPath) -} - task CleanPublish { if ($(Test-Path "$BuildRoot\publish")) { Remove-Item -Recurse -Path "$BuildRoot\publish\*" + } else { + New-Item -Path $BuildRoot -Name "publish" -ItemType Directory } + New-Item -Path $moduleOutPath -ItemType "Directory" } #EndRegion @@ -134,7 +130,7 @@ task UpdateMarkdownHelp quickBuild, CheckPlatyPSInstalled, { #EndRegion #Region - Build Module Files -task CreatePsd1ForRelease CleanTemp, { +task CreatePsd1ForRelease CleanPublish, { $functionsToExport = Get-ChildItem -Path 'ZertoApiWrapper\Public\*.ps1' | ForEach-Object { $_.BaseName } $releaseNotes = "Please review the [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/{0}) on GitHub." -f $version @@ -182,30 +178,18 @@ task CreatePsm1ForRelease CreatePsd1ForRelease, { Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8' Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8' } - # Add-Content -Path $psm1Path -Value $emptyLine - # Add-Content -Path $psm1Path -Value "Export-ModuleMember -Function $exportString" } #EndRegion #Region - Artifacts \ Publish # Full Build Process - No Publishing -task CreateArtifacts CleanPublish, CleanTemp, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, { - if (-not $(Test-Path "$BuildRoot\publish")) { - New-Item -Path $BuildRoot -Name "publish" -ItemType Directory - } - $CompressionPath = Split-Path -Path $moduleOutPath -Parent - Compress-Archive -Path $CompressionPath -DestinationPath .\publish\ZertoApiWrapper.zip - #ImportBuiltModule - #(Get-Module ZertoApiWrapper).ReleaseNotes | Add-Content .\publish\release-notes.txt - #(Get-Module ZertoApiWrapper).Version.ToString() | Add-Content .\publish\release-version.txt - Copy-Item "$BuildRoot\ZertoApiWrapper.build.ps1" "$BuildRoot\publish\ZertoApiWrapper.build.ps1" - Copy-Item "$BuildRoot\ZertoApiWrapper.Depend.psd1" "$BuildRoot\publish\ZertoApiWrapper.Depend.psd1" - Copy-Item "$BuildRoot\build.ps1" "$BuildRoot\publish\build.ps1" +task CreateArtifacts CleanPublish, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, { + Compress-Archive -Path $moduleOutPath -DestinationPath .\publish\ZertoApiWrapper.zip } #EndRegion -task build CleanPublish, CleanTemp, CreatePsm1ForRelease, AnalyzeBuiltFiles, BuiltFileTests, CreateArtifacts -task quickBuild CleanPublish, CleanTemp, CreatePsm1ForRelease, AnalyzeBuiltFiles, { +task build CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, BuiltFileTests, CreateArtifacts +task quickBuild CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, { Get-Module -Name ZertoApiWrapper | Remove-Module -Force ImportBuiltModule } From d3acba3967fd0476ddcbf7e4853beae709a25ee5 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 15:54:59 -0400 Subject: [PATCH 11/13] Remove Unused Publish Task --- azure-pipelines.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3a21d03..ceb0914 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -77,12 +77,6 @@ jobs: testRunTitle: "PSCore_Ubuntu_Built" displayName: "Publish Test Results" condition: always() - - task: PublishPipelineArtifact@0 - displayName: "Publish compiled module Artifact" - inputs: - artifactName: "ZertoApiWrapper" - targetPath: ./temp - condition: always() - task: PublishPipelineArtifact@0 displayName: "Publish Data" inputs: From de1a85cecd63777da453350df3a86e5de7eba6e6 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Wed, 10 Jun 2020 19:30:50 -0400 Subject: [PATCH 12/13] Add ReleaseNotes.md File Creation --- ZertoApiWrapper.build.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ZertoApiWrapper.build.ps1 b/ZertoApiWrapper.build.ps1 index 593e376..08efbac 100644 --- a/ZertoApiWrapper.build.ps1 +++ b/ZertoApiWrapper.build.ps1 @@ -185,6 +185,12 @@ task CreatePsm1ForRelease CreatePsd1ForRelease, { # Full Build Process - No Publishing task CreateArtifacts CleanPublish, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, { Compress-Archive -Path $moduleOutPath -DestinationPath .\publish\ZertoApiWrapper.zip + $MyMatches = Select-String -Path "$BuildRoot\CHANGELOG.md" "^##\s\[" + $data = Get-Content "$BuildRoot\CHANGELOG.md" + $range = ($MyMatches[0].LineNumber - 1)..($MyMatches[1].LineNumber - 3) + foreach ($i in $range) { + Add-Content -Path "$BuildRoot\publish\ReleaseNotes.md" -Value ($data[$i]).replace("## ", "# ") -Encoding utf8 + } } #EndRegion From f81a22ca80ab094094f0dfef0682b1aaeb477e94 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Thu, 11 Jun 2020 09:24:02 -0400 Subject: [PATCH 13/13] Update Artifact Publish task to latest --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ceb0914..b20a9a2 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -77,7 +77,7 @@ jobs: testRunTitle: "PSCore_Ubuntu_Built" displayName: "Publish Test Results" condition: always() - - task: PublishPipelineArtifact@0 + - task: PublishPipelineArtifact@1 displayName: "Publish Data" inputs: artifactName: "ReleaseData"