From 1855e497ccd92b184833db6fb259d14b3ce1c02f Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sun, 9 Jun 2019 17:50:00 -0700 Subject: [PATCH] updating Release --- build/azure-pipelines.yml | 56 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index e5c11f5..afc3680 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -102,7 +102,7 @@ stages: - stage: Deploy displayName: Deploy Artifacts - condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) jobs: - deployment: myget displayName: MyGet.org @@ -126,6 +126,60 @@ stages: runOnce: deploy: steps: + - powershell: | + try { + $artifactDirectory = $env:searchDirectory + Write-Host "Currect working directory - $artifactDirectory" + $nupkg = Get-ChildItem -Path $artifactDirectory -Filter *.nupkg -Recurse | Select-Object -First 1 + + if($null -eq $nupkg) + { + Throw "No NuGet Package could be found in the current directory" + } + + Write-Host "Package Name $($nupkg.Name)" + $nupkg.Name -match '^(.*?)\.((?:\.?[0-9]+){3,}(?:[-a-z]+)?)\.nupkg$' + $VersionName = $Matches[2] + $IsPreview = $VersionName -match '-pre$' + $ReleaseDisplayName = $VersionName + + if($null -eq $env:IS_PREVIEW) + { + Write-Output ("##vso[task.setvariable variable=IS_PREVIEW;]$IsPreview") + } + + if($true -eq $IsPreview) + { + $baseVersion = $VersionName.Split('-')[0] + $ReleaseDisplayName = "$baseVersion - Preview" + } + + Write-Host "Version Name - $VersionName" + Write-Host "Release Display Name - $ReleaseDisplayName" + + Write-Output ("##vso[task.setvariable variable=VersionName;]$VersionName") + Write-Output ("##vso[task.setvariable variable=ReleaseDisplayName;]$ReleaseDisplayName") + } + catch { + Write-Error $_ + exit 1 + } + displayName: Process Artifacts for Release + env: + searchDirectory: $(Pipeline.Workspace) + + - task: GithubRelease@0 + displayName: 'Create GitHub Release' + inputs: + gitHubConnection: dansiegel + title: '$(ReleaseDisplayName)' + tagSource: manual + tag: 'v$(VersionName)' + isPreRelease: $(IS_PREVIEW) + assets: $(Pipeline.Workspace)/**/*.nupkg + isDraft: true + addChangeLog: true + - task: NuGetCommand@2 displayName: 'NuGet push' inputs: