Skip to content

Commit

Permalink
add new pipeline file for publishing releases (#9)
Browse files Browse the repository at this point in the history
add new pipeline file for publishing releases
  • Loading branch information
evilpilaf authored Dec 10, 2019
2 parents 381d642 + d170bbb commit 5e2f01e
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 67 deletions.
80 changes: 13 additions & 67 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# 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
name: $(Rev:r)

trigger:
branches:
Expand All @@ -15,8 +16,6 @@ trigger:
- LICENSE.TXT
- README.md

name: $(Rev:r)

jobs:
- job: Windows

Expand All @@ -27,68 +26,15 @@ jobs:
buildConfiguration: Release

steps:
- pwsh: |
Write-Output 'BUILD_PR=$(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER) BUILD_ID=$(BUILD.BUILDNUMBER)'
displayName: "Echo the build variables"
- pwsh: |
[string]$latestTag=iex 'git describe --tags --abbrev=0'
[string]$version="v$latestTag.$(BUILD.BUILDNUMBER)"
Write-Output "##vso[build.updatebuildnumber]$version"
displayName: "Set buld task name"
- task: UseDotNet@2
displayName: "Add dotnet core 2.1"
inputs:
version: 2.1.x
packageType: sdk
includePreviewVersions: false

- task: UseDotNet@2
displayName: "Use dotnet core 3.1"
inputs:
version: 3.1.x
packageType: sdk
includePreviewVersions: true

- task: DotNetCoreCLI@2
displayName: "Restore packages"
inputs:
command: "restore"
projects: "HoneycombSerilogSink.sln"

- task: DotNetCoreCLI@2
displayName: "Build"
env:
BUILD_PR: $(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER)
BUILD_ID: $(BUILD.BUILDNUMBER)
inputs:
command: "build"
projects: "HoneycombSerilogSink.sln"
arguments: '-c $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: 'Test'
inputs:
command: 'test'
projects: 'HoneycombSerilogSink.sln'
arguments: '--no-restore --no-build -c $(buildConfiguration) --collect "Code coverage"'

- task: DotNetCoreCLI@2
displayName: 'Package'
env:
BUILD_PR: $(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER)
BUILD_ID: $(BUILD.BUILDNUMBER)
inputs:
command: 'pack'
arguments: '.\src\Honeycomb.Serilog.Sink\Honeycomb.Serilog.Sink.csproj --output $(Build.ArtifactStagingDirectory) --configuration $(buildConfiguration) --no-build'

- task: PublishBuildArtifacts@1
displayName: 'Publish built artifacts'
env:
BUILD_PR: $(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER)
BUILD_ID: $(BUILD.BUILDNUMBER)
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'nuget'
publishLocation: 'Container'
- pwsh: |
displayName: "Echo the build variables"
- pwsh: |
[string]$latestTag=iex 'git describe --tags --abbrev=0'
[string]$version="v$latestTag.$(BUILD.BUILDNUMBER)"
Write-Output 'BUILD_PR=$(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER) BUILD_ID=$(BUILD.BUILDNUMBER)'
Write-Output "##vso[task.setvariable variable=releaseTag]$latestTag"
Write-Host "##vso[build.updatebuildnumber]$version"
displayName: "Set buld task name"
- template: ci/templates/build-and-package.yml
57 changes: 57 additions & 0 deletions ci/templates/build-and-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
steps:

- task: UseDotNet@2
displayName: "Add dotnet core 2.1"
inputs:
version: 2.1.x
packageType: sdk
includePreviewVersions: false

- task: UseDotNet@2
displayName: "Use dotnet core 3.1"
inputs:
version: 3.1.x
packageType: sdk
includePreviewVersions: true

- task: DotNetCoreCLI@2
displayName: "Restore packages"
inputs:
command: "restore"
projects: "HoneycombSerilogSink.sln"

- task: DotNetCoreCLI@2
displayName: "Build"
env:
BUILD_PR: $(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER)
BUILD_ID: $(BUILD.BUILDNUMBER)
inputs:
command: "build"
projects: "HoneycombSerilogSink.sln"
arguments: '-c $(buildConfiguration)'

- task: DotNetCoreCLI@2
displayName: 'Test'
inputs:
command: 'test'
projects: 'HoneycombSerilogSink.sln'
arguments: '--no-restore --no-build -c $(buildConfiguration) --collect "Code coverage"'

- task: DotNetCoreCLI@2
displayName: 'Package'
env:
BUILD_PR: $(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER)
BUILD_ID: $(BUILD.BUILDNUMBER)
inputs:
command: 'pack'
arguments: '.\src\Honeycomb.Serilog.Sink\Honeycomb.Serilog.Sink.csproj --output $(Build.ArtifactStagingDirectory) --configuration $(buildConfiguration) --no-build'

- task: PublishBuildArtifacts@1
displayName: 'Publish built artifacts'
env:
BUILD_PR: $(SYSTEM.PULLREQUEST.PULLREQUESTNUMBER)
BUILD_ID: $(BUILD.BUILDNUMBER)
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'nuget'
publishLocation: 'Container'
47 changes: 47 additions & 0 deletions release-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
tags:
include:
- "*"

pr: none

pool:
vmImage: 'windows-latest'

steps:
- pwsh: |
[string]$latestTag=iex 'git describe --tags --abbrev=0'
[string]$version="v$latestTag.$(BUILD.BUILDNUMBER)"
Write-Output "##vso[task.setvariable variable=releaseTag]$latestTag"
Write-Output "##vso[task.setvariable variable=version]$version"
displayName: "Set buld task name"

- template: ci/templates/build-and-package.yml

- pwsh: |
Write-Host "##vso[build.updatebuildnumber]$(latestTag)"
- task: NuGetAuthenticate@0
inputs:
nuGetServiceConnections: 'HoneycombSinkNugetFeed'

- task: NuGetCommand@2
displayName: 'Push package to nuget'
inputs:
command: push
nuGetFeedType: external
publishFeedCredentials: HoneycombSinkNugetFeed

- task: GitHubRelease@1
inputs:
gitHubConnection: GithubServiceConnection
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
releaseNotesSource: 'inline'
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
tag: $(latestTag)

0 comments on commit 5e2f01e

Please sign in to comment.