Merge pull request #3435 from tidusjar/feature/pipeline-improvements

Feature/pipeline improvements
pull/3528/head
Jamie 5 years ago committed by GitHub
commit fafd06636d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,18 @@
name: '$(Build.SourceBranchName)_$(Date:yyyy.MM.dd)$(Rev:.r)'
trigger: none
variables:
- template: templates/variables.yml
jobs:
- job: Build
pool:
vmImage: ${{ variables.vmImage }}
steps:
- template: templates/build-steps.yml
- job: Publish
pool:
vmImage: ${{ variables.vmImage }}
steps:
- template: templates/publish-stepsnew.yml

@ -0,0 +1,65 @@
variables:
- template: templates/variables.yml
stages:
- stage: build
jobs:
- job: Build
pool:
vmImage: ${{ variables.vmImage }}
steps:
- template: templates/build-steps.yml
- stage: publish
jobs:
- job:
strategy:
matrix:
win10-x64:
runtime: win10-x64
win10-x86:
runtime: win10-x86
osx-x64:
runtime: osx-x64
linux-x64:
runtime: linux-x64
linux-arm:
runtime: linux-arm
linux-arm64:
runtime: linux-arm64
pool:
vmImage: ${{ variables.vmImage }}
steps:
- template: templates/publish-os-steps.yml
- stage: deploy
jobs:
- job:
steps:
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
targetPath: '$(System.ArtifactsDirectory)'
- pwsh: |
Get-ChildItem -Recurse ($env:SYSTEM_ARTIFACTSDIRECTORY)
# - task: GitHubRelease@1
# inputs:
# gitHubConnection: 'github.com_tidusjar'
# repositoryName: 'tidusjar/Ombi.Releases'
# action: 'create'
# target: 'c7fcbb77b58aef1076d635a9ef99e4374abc8672'
# tagSource: 'userSpecifiedTag'
# tag: '$(gitTag)'
# releaseNotesSource: 'inline'
# releaseNotesInline: '$(ReleaseNotes)'
# assets: |
# $(Build.ArtifactStagingDirectory)/*.zip
# $(Build.ArtifactStagingDirectory)/*.gz
# isPreRelease: true
# changeLogCompareToRelease: 'lastNonDraftRelease'
# changeLogType: 'commitBased'
# condition: and(succeeded(), eq(variables['PublishToGithub'], 'true'))

@ -0,0 +1,55 @@
steps:
## This is needed due to https://github.com/microsoft/azure-pipelines-tasks/issues/8429
## For the set version tool...
- task: DotNetCoreInstaller@1
displayName: 'Use .NET Core sdk '
inputs:
packageType: 'sdk'
version: '3.x'
- task: DotNetCoreInstaller@1
displayName: 'Use .NET Core sdk for versioning'
inputs:
packageType: 'sdk'
version: '2.1.x'
- task: PowerShell@2
displayName: 'Get Release Notes'
inputs:
targetType: 'inline'
script: |
$response = Invoke-WebRequest -Uri "https://ombireleasenote.azurewebsites.net/api/ReleaseNotesFunction?buildId=$(Build.BuildId)"
Write-Host "##vso[task.setvariable variable=ReleaseNotes;]$response"
- task: PowerShell@2
displayName: 'Set Version'
inputs:
targetType: 'inline'
script: |
dotnet tool install -g dotnet-setversion
setversion -r $(BuildVersion)
- task: Yarn@3
displayName: 'Install UI Dependancies'
inputs:
projectDirectory: '$(UiLocation)'
arguments: 'install'
- task: Yarn@3
displayName: 'Build and Publish Angular App'
inputs:
projectDirectory: '$(UiLocation)'
arguments: 'run build'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(UiLocation)dist'
artifact: 'angular_dist'
publishLocation: 'pipeline'
- task: DotNetCoreCLI@2
displayName: Run Unit Tests
inputs:
comand: 'test'
projects: '$(TestProject)'
continueOnError: true

@ -0,0 +1,37 @@
steps:
- task: DotNetCoreCLI@2
displayName: 'publish $(runtime)'
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c $(BuildConfiguration) -r "$(runtime)" -o $(Build.ArtifactStagingDirectory)/$(runtime)'
zipAfterPublish: false
modifyOutputPath: false
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: 'angular_dist'
targetPath: '$(Build.ArtifactStagingDirectory)/angular_dist'
- task: CopyFiles@2
displayName: 'Copy Angular App $(runtime)'
inputs:
SourceFolder: '$(Build.ArtifactStagingDirectory)/angular_dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(runtime)/ClientApp/dist'
- task: ArchiveFiles@2
displayName: 'Zip $(runtime)'
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/$(runtime)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(runtime).zip'
replaceExistingArchive: true
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/$(runtime).zip'
artifact: '$(runtime)'
publishLocation: 'pipeline'

@ -0,0 +1,171 @@
steps:
- task: DotNetCoreCLI@2
displayName: Publish Win10-x64
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c $(BuildConfiguration) -r "win10-x64" -o $(Build.ArtifactStagingDirectory)/win-64'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
displayName: 'Copy Angular App Win10-x64'
inputs:
SourceFolder: '$(UiLocation)dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/win-64/ClientApp/dist'
- task: DotNetCoreCLI@2
displayName: Publish Win10-x86
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c $(BuildConfiguration) -r "win10-x86" -o $(Build.ArtifactStagingDirectory)/win-86'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
displayName: 'Copy Angular App Win10-x86'
inputs:
SourceFolder: '$(UiLocation)dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/win-86/ClientApp/dist'
- task: DotNetCoreCLI@2
displayName: Publish OSX-x64
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c $(BuildConfiguration) -r "osx-x64" -o $(Build.ArtifactStagingDirectory)/osx-64'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
displayName: 'Copy Angular App OSX-x64'
inputs:
SourceFolder: '$(UiLocation)dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/osx-64/ClientApp/dist'
- task: DotNetCoreCLI@2
displayName: Publish Linux-x64
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c $(BuildConfiguration) -r "linux-x64" -o $(Build.ArtifactStagingDirectory)/linux-64'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
displayName: 'Copy Angular App Linux-x64'
inputs:
SourceFolder: '$(UiLocation)dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/linux-64/ClientApp/dist'
- task: DotNetCoreCLI@2
displayName: Publish Linux-ARM
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c $(BuildConfiguration) -r "linux-arm" -o $(Build.ArtifactStagingDirectory)/linux-arm'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
displayName: 'Copy Angular App Linux-ARM'
inputs:
SourceFolder: '$(UiLocation)dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/linux-arm/ClientApp/dist'
- task: DotNetCoreCLI@2
displayName: Publish Linux-ARM-x64
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c $(BuildConfiguration) -r "linux-arm64" -o $(Build.ArtifactStagingDirectory)/linux-arm64'
zipAfterPublish: false
modifyOutputPath: false
- task: CopyFiles@2
displayName: 'Copy Angular App Linux-ARM64'
inputs:
SourceFolder: '$(UiLocation)dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/linux-arm64/ClientApp/dist'
### Zip them up
- task: ArchiveFiles@2
displayName: Zip Win-x64
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/win-64'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/win-x64-$(Build.BuildId).zip'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Zip Win-x86
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/win-86'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/win-x86-$(Build.BuildId).zip'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Zip OSX-x64
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/osx-64'
includeRootFolder: false
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/osx-x64-$(Build.BuildId).tar.gz'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Zip Linux-x64
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/linux-64'
includeRootFolder: false
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/linux-x64-$(Build.BuildId).tar.gz'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Zip Linux-ARM
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/linux-arm'
includeRootFolder: false
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/linux-arm-$(Build.BuildId).tar.gz'
replaceExistingArchive: true
- task: ArchiveFiles@2
displayName: Zip Linux-ARM-x64
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/linux-arm64'
includeRootFolder: false
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/linux-arm64-$(Build.BuildId).tar.gz'
replaceExistingArchive: true
- task: GitHubRelease@1
inputs:
gitHubConnection: 'github.com_tidusjar'
repositoryName: 'tidusjar/Ombi.Releases'
action: 'create'
target: 'c7fcbb77b58aef1076d635a9ef99e4374abc8672'
tagSource: 'userSpecifiedTag'
tag: '$(gitTag)'
releaseNotesSource: 'inline'
releaseNotesInline: '$(ReleaseNotes)'
assets: |
$(Build.ArtifactStagingDirectory)/*.zip
$(Build.ArtifactStagingDirectory)/*.gz
isPreRelease: true
changeLogCompareToRelease: 'lastNonDraftRelease'
changeLogType: 'commitBased'
condition: and(succeeded(), eq(variables['PublishToGithub'], 'true'))

@ -0,0 +1,27 @@
variables:
- name: "BuildConfiguration"
value: "Release"
- name: "vmImage"
value: "ubuntu-latest"
- name: "Solution"
value: "**/*.sln"
- name: "TestProject"
value: "**/*.Tests.csproj"
- name: "NetCoreVersion"
value: "3.1"
- name: "PublishLocation"
value: "$(Build.SourcesDirectory)/src/Ombi/bin/Release/netcoreapp$(NetCoreVersion)"
- name: "GitTag"
value: "v$(buildVersion)"
- name: "UiLocation"
value: "$(Build.SourcesDirectory)/src/Ombi/ClientApp/"
- name: "BuildVersion"
value: "4.0.$(Build.BuildId)"

@ -9,7 +9,7 @@
trigger:
branches:
include:
- feature/*
- feature/v4*
exclude:
- develop
- master
@ -19,7 +19,7 @@ variables:
testProj: '**/*.Tests.csproj'
csProj: '**/*.csproj'
buildConfiguration: 'Release'
publishLocation: '$(Build.SourcesDirectory)/src/Ombi/bin/Release/netcoreapp3.0'
publishLocation: '$(Build.SourcesDirectory)/src/Ombi/bin/Release/netcoreapp3.1'
pool:
vmImage: 'ubuntu-latest'

Loading…
Cancel
Save