Skip to content

Commit

Permalink
updating Release
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Jun 10, 2019
1 parent bc8d99b commit 1855e49
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 1855e49

Please sign in to comment.