Skip to content

Instantly share code, notes, and snippets.

@fernandoseguim
Created March 27, 2020 20:44
Show Gist options
  • Save fernandoseguim/bf34279431bbf322414f7c35ae6cb932 to your computer and use it in GitHub Desktop.
Save fernandoseguim/bf34279431bbf322414f7c35ae6cb932 to your computer and use it in GitHub Desktop.
# 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
variables:
BuildConfiguration: Release
FORCE_PUSH_NUGET: ${{ eq(variables['Build.SourceBranch'], 'refs/heads/develop') }}
trigger:
branches:
include:
- master
- develop
paths:
include:
- src/*
- test/*
- azure-pipelines.yml
resources:
containers:
- container: dynamodb
image: amazon/dynamodb-local
ports:
- 8000:8000
env:
AWS_ACCESS_KEY_ID: root
AWS_SECRET_ACCESS_KEY: secret
stages:
- stage: Build
jobs:
- job: Build
displayName: Build Artifacts
pool:
vmImage: 'ubuntu-latest'
timeoutInMinutes: 10
services:
dynamodb: dynamodb
steps:
- task: GitVersion@5
displayName: 'Define git version'
inputs:
updateAssemblyInfo: true
preferBundledVersion: false
- script: echo '%Action%%BuildVersion%'
displayName: 'Set build version'
env:
Action: '##vso[build.updatebuildnumber]'
BuildVersion: $(GitVersion.SemVer)
- task: DotNetCoreCLI@2
displayName: 'Dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'
- task: DotNetCoreCLI@2
displayName: 'Dotnet build'
inputs:
projects: '**/*.csproj'
arguments: '--configuration $(BuildConfiguration) /p:Version=$(GitVersion.NuGetVersionV2)'
- task: DotNetCoreCLI@2
displayName: 'Dotnet test'
inputs:
command: test
projects: '**/*[Tt]est*/*.csproj'
arguments: '--configuration $(BuildConfiguration)'
- script: |
dotnet pack src/MassTransist.DynamoDbIntegration/MassTransist.DynamoDbIntegration.csproj --configuration $(BuildConfiguration) /p:VersionPrefix='$(GitVersion.NuGetVersionV2)' --include-symbols --no-build -o '$(build.artifactStagingDirectory)'
displayName: 'Dotnet pack'
- task: NuGetCommand@2
displayName: 'Push package to nuget.org feed'
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg;!$(Build.ArtifactStagingDirectory)/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'NuGetFeed'
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq('true', variables['FORCE_PUSH_NUGET'])))
- task: PublishPipelineArtifact@0
inputs:
artifactName: 'build-assets'
targetPath: '$(Build.ArtifactStagingDirectory)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment