From e20c048eb13c408077a29da1fe5b9cd7833302c3 Mon Sep 17 00:00:00 2001 From: Kevin Marquette Date: Tue, 16 Oct 2018 09:14:03 -0700 Subject: [PATCH 1/4] add support for Azure DevOps Pipelines resolves #18 --- BuildTasks/PublishModule.Task.ps1 | 12 +++++++++--- azure-pipelines.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 azure-pipelines.yml diff --git a/BuildTasks/PublishModule.Task.ps1 b/BuildTasks/PublishModule.Task.ps1 index 305e19d..bf01c12 100644 --- a/BuildTasks/PublishModule.Task.ps1 +++ b/BuildTasks/PublishModule.Task.ps1 @@ -2,17 +2,22 @@ task PublishModule { if ( $ENV:BHBuildSystem -ne 'Unknown' -and $ENV:BHBranchName -eq "master" -and - [string]::IsNullOrWhiteSpace($ENV:APPVEYOR_PULL_REQUEST_NUMBER) -and - -not [string]::IsNullOrWhiteSpace($ENV:NugetApiKey)) + -not [string]::IsNullOrWhiteSpace($ENV:nugetapikey)) { $publishModuleSplat = @{ Path = $Destination - NuGetApiKey = $ENV:NugetApiKey + NuGetApiKey = $ENV:nugetapikey Verbose = $true Force = $true Repository = $PSRepository ErrorAction = 'Stop' } + "Files in module output:" + Get-ChildItem $Destination -Recurse -File | + Select-Object -Expand FullName + + "Publishing [$Destination] to [$PSRepository]" + Publish-Module @publishModuleSplat } else @@ -20,6 +25,7 @@ task PublishModule { "Skipping deployment: To deploy, ensure that...`n" + "`t* You are in a known build system (Current: $ENV:BHBuildSystem)`n" + "`t* You are committing to the master branch (Current: $ENV:BHBranchName) `n" + + "`t* The repository APIKey is defined in `$ENV:nugetapikey (Current: $(![string]::IsNullOrWhiteSpace($ENV:nugetapikey))) `n" + "`t* This is not a pull request" } } diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..c982e14 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,26 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +#resources: +#- repo: self +# clean: true +# fetchDepth: 1 +#queue: +# name: Hosted VS2017 +trigger: + batch: true + branches: + include: + - master + +pool: + vmImage: 'Ubuntu 16.04' + +steps: +- script: pwsh -File build.ps1 Publish + displayName: 'Build and Publish Module' + env: + nugetapikey: $(nugetapikey) + From 00de5a093a3028df08b0515c68afd15841e0fdfc Mon Sep 17 00:00:00 2001 From: Kevin Marquette Date: Tue, 16 Oct 2018 09:15:50 -0700 Subject: [PATCH 2/4] remove comments --- BuildTasks/BuildModule.Task.ps1 | 2 +- azure-pipelines.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/BuildTasks/BuildModule.Task.ps1 b/BuildTasks/BuildModule.Task.ps1 index 7b2fc88..85df93c 100644 --- a/BuildTasks/BuildModule.Task.ps1 +++ b/BuildTasks/BuildModule.Task.ps1 @@ -86,6 +86,6 @@ taskx BuildModule @{ Set-Content -Path $ModulePath -Value $sb.ToString() -Encoding 'UTF8' 'Moving "#Requires" statements and "using" directives...' - Move-Statement -Path $ModulePath -Type 'Comment', 'Keyword' -Token '#Requires', 'using' -Index 0 + #Move-Statement -Path $ModulePath -Type 'Comment', 'Keyword' -Token '#Requires', 'using' -Index 0 } } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c982e14..d976f2c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,8 +7,7 @@ #- repo: self # clean: true # fetchDepth: 1 -#queue: -# name: Hosted VS2017 + trigger: batch: true branches: From fecb5d3605bb57c32d5bfd87d18224a24f7226e6 Mon Sep 17 00:00:00 2001 From: Kevin Marquette Date: Tue, 16 Oct 2018 09:16:49 -0700 Subject: [PATCH 3/4] revert commit --- BuildTasks/BuildModule.Task.ps1 | 2 +- azure-pipelines.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BuildTasks/BuildModule.Task.ps1 b/BuildTasks/BuildModule.Task.ps1 index 85df93c..7b2fc88 100644 --- a/BuildTasks/BuildModule.Task.ps1 +++ b/BuildTasks/BuildModule.Task.ps1 @@ -86,6 +86,6 @@ taskx BuildModule @{ Set-Content -Path $ModulePath -Value $sb.ToString() -Encoding 'UTF8' 'Moving "#Requires" statements and "using" directives...' - #Move-Statement -Path $ModulePath -Type 'Comment', 'Keyword' -Token '#Requires', 'using' -Index 0 + Move-Statement -Path $ModulePath -Type 'Comment', 'Keyword' -Token '#Requires', 'using' -Index 0 } } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d976f2c..c982e14 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,7 +7,8 @@ #- repo: self # clean: true # fetchDepth: 1 - +#queue: +# name: Hosted VS2017 trigger: batch: true branches: From ace42677ad4c5d60b892c4d776cee45ebd08be2f Mon Sep 17 00:00:00 2001 From: Kevin Marquette Date: Tue, 16 Oct 2018 09:17:29 -0700 Subject: [PATCH 4/4] remove comment --- azure-pipelines.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c982e14..d976f2c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -7,8 +7,7 @@ #- repo: self # clean: true # fetchDepth: 1 -#queue: -# name: Hosted VS2017 + trigger: batch: true branches: