|  | @@ -0,0 +1,122 @@
 | 
	
		
			
				|  |  | +jobs:
 | 
	
		
			
				|  |  | +- job: BuildPackage
 | 
	
		
			
				|  |  | +  displayName: 'Build Packages'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  strategy:
 | 
	
		
			
				|  |  | +    matrix:
 | 
	
		
			
				|  |  | +      CentOS.amd64:
 | 
	
		
			
				|  |  | +        BuildConfiguration: centos.amd64
 | 
	
		
			
				|  |  | +      Fedora.amd64:
 | 
	
		
			
				|  |  | +        BuildConfiguration: fedora.amd64
 | 
	
		
			
				|  |  | +      Debian.amd64:
 | 
	
		
			
				|  |  | +        BuildConfiguration: debian.amd64
 | 
	
		
			
				|  |  | +      Debian.arm64:
 | 
	
		
			
				|  |  | +        BuildConfiguration: debian.arm64
 | 
	
		
			
				|  |  | +      Debian.armhf:
 | 
	
		
			
				|  |  | +        BuildConfiguration: debian.armhf
 | 
	
		
			
				|  |  | +      Ubuntu.amd64:
 | 
	
		
			
				|  |  | +        BuildConfiguration: ubuntu.amd64
 | 
	
		
			
				|  |  | +      Ubuntu.arm64:
 | 
	
		
			
				|  |  | +        BuildConfiguration: ubuntu.arm64
 | 
	
		
			
				|  |  | +      Ubuntu.armhf:
 | 
	
		
			
				|  |  | +        BuildConfiguration: ubuntu.armhf
 | 
	
		
			
				|  |  | +      Linux.amd64:
 | 
	
		
			
				|  |  | +        BuildConfiguration: linux.amd64
 | 
	
		
			
				|  |  | +      Windows.amd64:
 | 
	
		
			
				|  |  | +        BuildConfiguration: windows.amd64
 | 
	
		
			
				|  |  | +      MacOS:
 | 
	
		
			
				|  |  | +        BuildConfiguration: macos
 | 
	
		
			
				|  |  | +      Portable:
 | 
	
		
			
				|  |  | +        BuildConfiguration: portable
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  pool:
 | 
	
		
			
				|  |  | +    vmImage: 'ubuntu-latest'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  steps:
 | 
	
		
			
				|  |  | +  - script: 'docker build -f deployment/Dockerfile.$(BuildConfiguration) -t jellyfin-server-$(BuildConfiguration) deployment'
 | 
	
		
			
				|  |  | +    displayName: 'Build Dockerfile'
 | 
	
		
			
				|  |  | +    condition: or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), startsWith(variables['Build.SourceBranch'], 'refs/heads/azure-ci'))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin -e IS_UNSTABLE="yes" -e BUILD_ID=$(Build.BuildNumber) jellyfin-server-$(BuildConfiguration)'
 | 
	
		
			
				|  |  | +    displayName: 'Run Dockerfile (unstable)'
 | 
	
		
			
				|  |  | +    condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/azure-ci')
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin -e IS_UNSTABLE="no" -e BUILD_ID=$(Build.BuildNumber) jellyfin-server-$(BuildConfiguration)'
 | 
	
		
			
				|  |  | +    displayName: 'Run Dockerfile (stable)'
 | 
	
		
			
				|  |  | +    condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  - task: PublishPipelineArtifact@1
 | 
	
		
			
				|  |  | +    displayName: 'Publish Release'
 | 
	
		
			
				|  |  | +    condition: or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), startsWith(variables['Build.SourceBranch'], 'refs/heads/azure-ci'))
 | 
	
		
			
				|  |  | +    inputs:
 | 
	
		
			
				|  |  | +      targetPath: '$(Build.SourcesDirectory)/deployment/dist'
 | 
	
		
			
				|  |  | +      artifactName: 'jellyfin-server-$(BuildConfiguration)'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  - task: CopyFilesOverSSH@0
 | 
	
		
			
				|  |  | +    displayName: 'Upload artifacts to repository server'
 | 
	
		
			
				|  |  | +    condition: or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), startsWith(variables['Build.SourceBranch'], 'refs/heads/azure-ci'))
 | 
	
		
			
				|  |  | +    inputs:
 | 
	
		
			
				|  |  | +      sshEndpoint: repository
 | 
	
		
			
				|  |  | +      sourceFolder: '$(Build.SourcesDirectory)/deployment/dist'
 | 
	
		
			
				|  |  | +      contents: '**'
 | 
	
		
			
				|  |  | +      targetFolder: '/srv/repository/incoming/azure/$(Build.BuildNumber)/$(BuildConfiguration)'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +- job: BuildDocker
 | 
	
		
			
				|  |  | +  displayName: 'Build Docker'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  pool:
 | 
	
		
			
				|  |  | +    vmImage: 'ubuntu-latest'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  steps:
 | 
	
		
			
				|  |  | +  - task: Docker@2
 | 
	
		
			
				|  |  | +    displayName: 'Push Unstable Image'
 | 
	
		
			
				|  |  | +    condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/azure-ci')
 | 
	
		
			
				|  |  | +    inputs:
 | 
	
		
			
				|  |  | +      repository: 'jellyfin/jellyfin-server'
 | 
	
		
			
				|  |  | +      command: buildAndPush
 | 
	
		
			
				|  |  | +      buildContext: '.'
 | 
	
		
			
				|  |  | +      Dockerfile: 'deployment/Dockerfile.docker'
 | 
	
		
			
				|  |  | +      containerRegistry: Docker Hub
 | 
	
		
			
				|  |  | +      tags: |
 | 
	
		
			
				|  |  | +        unstable-$(Build.BuildNumber)
 | 
	
		
			
				|  |  | +        unstable
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  - task: Docker@2
 | 
	
		
			
				|  |  | +    displayName: 'Push Stable Image'
 | 
	
		
			
				|  |  | +    condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
 | 
	
		
			
				|  |  | +    inputs:
 | 
	
		
			
				|  |  | +      repository: 'jellyfin/jellyfin-server'
 | 
	
		
			
				|  |  | +      command: buildAndPush
 | 
	
		
			
				|  |  | +      buildContext: '.'
 | 
	
		
			
				|  |  | +      Dockerfile: 'deployment/Dockerfile.docker'
 | 
	
		
			
				|  |  | +      containerRegistry: Docker Hub
 | 
	
		
			
				|  |  | +      tags: |
 | 
	
		
			
				|  |  | +        stable-$(Build.BuildNumber)
 | 
	
		
			
				|  |  | +        stable
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +- job: CollectArtifacts
 | 
	
		
			
				|  |  | +  displayName: 'Collect Artifacts'
 | 
	
		
			
				|  |  | +  dependsOn:
 | 
	
		
			
				|  |  | +  - BuildPackage
 | 
	
		
			
				|  |  | +  - BuildDocker
 | 
	
		
			
				|  |  | +  condition: and(succeeded('BuildPackage'), succeeded('BuildDocker'))
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  pool:
 | 
	
		
			
				|  |  | +    vmImage: 'ubuntu-latest'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  steps:
 | 
	
		
			
				|  |  | +  - task: SSH@0
 | 
	
		
			
				|  |  | +    displayName: 'Update Unstable Repository'
 | 
	
		
			
				|  |  | +    condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/azure-ci')
 | 
	
		
			
				|  |  | +    inputs:
 | 
	
		
			
				|  |  | +      sshEndpoint: repository
 | 
	
		
			
				|  |  | +      runOptions: 'inline'
 | 
	
		
			
				|  |  | +      inline: 'sudo /srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber) unstable'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +  - task: SSH@0
 | 
	
		
			
				|  |  | +    displayName: 'Update Stable Repository'
 | 
	
		
			
				|  |  | +    condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
 | 
	
		
			
				|  |  | +    inputs:
 | 
	
		
			
				|  |  | +      sshEndpoint: repository
 | 
	
		
			
				|  |  | +      runOptions: 'inline'
 | 
	
		
			
				|  |  | +      inline: 'sudo /srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber)'
 |