jellyfin-vue/.ci/azure-pipelines-build.yml
2020-10-15 06:20:58 +00:00

144 lines
4.8 KiB
YAML

jobs:
- job: Build
displayName: 'Build'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: NodeTool@0
displayName: 'Install node'
inputs:
versionSpec: '12.x'
- task: Cache@2
displayName: 'Check cache'
inputs:
key: 'yarn | yarn.lock'
path: 'node_modules'
cacheHitVar: CACHE_RESTORED
- script: 'yarn install --frozen-lockfile'
displayName: 'Install dependencies'
condition: ne(variables.CACHE_RESTORED, 'true')
- script: 'yarn build'
displayName: 'Build'
- job: BuildDocker
displayName: 'Build docker image'
strategy:
matrix:
amd64:
BuildConfiguration: amd64
arm64:
BuildConfiguration: arm64
armhf:
BuildConfiguration: armhf
pool:
vmImage: 'ubuntu-latest'
variables:
- name: Version
value: $[replace(variables['Build.SourceBranch'],'refs/tags/v','')]
steps:
- task: Docker@2
displayName: 'Build and push unstable docker image'
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
inputs:
repository: 'jellyfin/jellyfin-vue'
command: buildAndPush
buildContext: '.'
Dockerfile: 'Dockerfile'
containerRegistry: Docker Hub
tags: |
unstable-$(Build.BuildNumber)-$(BuildConfiguration)
unstable-$(BuildConfiguration)
- task: Docker@2
displayName: 'Build and push PR docker images'
condition: startsWith(variables['System.PullRequest.TargetBranch'], 'refs/heads/master')
inputs:
repository: 'jellyfin/jellyfin-vue'
command: buildAndPush
buildContext: '.'
Dockerfile: 'Dockerfile'
containerRegistry: Docker Hub
tags: |
pr-$(System.PullRequest.PullRequestId)-$(BuildConfiguration)
- task: Docker@2
displayName: 'Build and push stable docker images'
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/v')
inputs:
repository: 'jellyfin/jellyfin-vue'
command: buildAndPush
buildContext: '.'
Dockerfile: 'Dockerfile'
containerRegistry: Docker Hub
tags: |
stable-$(Build.BuildNumber)-$(BuildConfiguration)
$(Version)-$(BuildConfiguration)
- job: PushManifests
displayName: 'Build and publish docker manifests'
pool:
vmImage: 'ubuntu-latest'
variables:
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- script: |
# sudo sed -i '$s/}/,\n"experimental": true\n}/' /etc/docker/daemon.json
echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
docker version
displayName: 'Enable experimental features in Docker server'
- script: |
docker manifest create \
jellyfin/jellyfin-vue:unstable \
--amend jellyfin/jellyfin-vue:unstable-armhf \
--amend jellyfin/jellyfin-vue:unstable-amd64 \
--amend jellyfin/jellyfin-vue:unstable-arm64
displayName: Build unstable manifest
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
- script: |
docker manifest push jellyfin/jellyfin-vue:unstable
displayName: Push unstable manifest
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
- script: |
docker manifest create \
jellyfin/jellyfin-vue:pr-$(System.PullRequest.PullRequestId) \
--amend jellyfin/jellyfin-vue:pr-$(System.PullRequest.PullRequestId)-armhf \
--amend jellyfin/jellyfin-vue:pr-$(System.PullRequest.PullRequestId)-amd64 \
--amend jellyfin/jellyfin-vue:pr-$(System.PullRequest.PullRequestId)-arm64
displayName: Build PR manifest
condition: startsWith(variables['System.PullRequest.TargetBranch'], 'refs/heads/master')
- script: |
docker manifest push jellyfin/jellyfin-vue:$(Version)
displayName: Push PR manifest
condition: startsWith(variables['System.PullRequest.TargetBranch'], 'refs/heads/master')
- script: |
docker manifest create \
jellyfin/jellyfin-vue:$(Version) \
--amend jellyfin/jellyfin-vue:$(Version)-armhf \
--amend jellyfin/jellyfin-vue:$(Version)-amd64 \
--amend jellyfin/jellyfin-vue:$(Version)-arm64
displayName: Build stable manifest
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/tags/v')
- script: |
docker manifest push jellyfin/jellyfin-vue:$(Version)
displayName: Push stable manifest
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/tags/v')