You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/ci-build.yaml

238 lines
6.9 KiB

5 years ago
5 years ago
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
branches:
include:
- feature/*
exclude:
5 years ago
- develop
- master
5 years ago
variables:
solution: '**/*.sln'
testProj: '**/*.Tests.csproj'
csProj: '**/*.csproj'
buildConfiguration: 'Release'
5 years ago
publishLocation: '$(Build.SourcesDirectory)/src/Ombi/bin/Release/netcoreapp3.0'
gitTag: 'v4.0.$(Build.BuildId)'
5 years ago
uiLocation: '$(Build.SourcesDirectory)/src/Ombi/ClientApp/'
5 years ago
pool:
vmImage: 'ubuntu-latest'
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 $(gitTag)
5 years ago
- task: Yarn@3
displayName: 'Install UI Dependancies'
5 years ago
inputs:
5 years ago
projectDirectory: '$(uiLocation)'
5 years ago
arguments: 'install'
- task: Yarn@3
5 years ago
displayName: 'Build and Publish Angular App'
inputs:
5 years ago
projectDirectory: '$(uiLocation)'
arguments: 'run build'
5 years ago
5 years ago
- task: DotNetCoreCLI@2
displayName: Run Unit Tests
inputs:
comand: 'test'
5 years ago
projects: '**/*Tests.csproj'
continueOnError: true
5 years ago
### Publish
- 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
5 years ago
- task: CopyFiles@2
5 years ago
displayName: 'Copy Angular App Win10-x64'
inputs:
5 years ago
SourceFolder: '$(uiLocation)dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/win-64/ClientApp/dist'
5 years ago
- task: DotNetCoreCLI@2
displayName: Publish Win10-x86
inputs:
command: 'publish'
publishWebProjects: true
arguments: '-c $(buildConfiguration) -r "win10-x86" -o $(Build.ArtifactStagingDirectory)/win-86'
- 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'
- 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'
- 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'
- 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'
- task: CopyFiles@2
displayName: 'Copy Angular App Linux-ARM64'
inputs:
SourceFolder: '$(uiLocation)dist'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)/linux-arm64/ClientApp/dist'
5 years ago
### 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
5 years ago
5 years ago
- task: ArchiveFiles@2
displayName: Zip Win-x86
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/win-86'
includeRootFolder: true
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: true
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: true
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: true
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: true
archiveType: 'tar'
archiveFile: '$(Build.ArtifactStagingDirectory)/linux-arm64-$(Build.BuildId).tar.gz'
replaceExistingArchive: true
- task: GitHubRelease@1
5 years ago
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'))