forked from madslundt/docker-cloud-media-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
51 lines (47 loc) · 2.02 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
trigger:
branches:
include:
- '*'
tags:
include:
- '*'
jobs:
- job: deploy
displayName: Build And Deploy
dependsOn: []
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
clean: true
- script: |
docker build -t yaoa/cloud-media-scripts:build -f ./Dockerfile .
docker login -u $(dockerId) -p $(dockerPassword)
export IMAGE_ID_TEMP=$(sudo docker images --filter=reference=yaoa/cloud-media-scripts:build --format "{{.ID}}")
echo '##vso[task.setvariable variable=image_id]'$IMAGE_ID_TEMP
displayName: Build Image
- script: |
docker tag $(image_id) yaoa/cloud-media-scripts:$BUILD_SOURCEVERSION
docker push yaoa/cloud-media-scripts:$BUILD_SOURCEVERSION
displayName: Deploy Commit ID
condition: eq(variables['System.PullRequest.IsFork'], 'False')
- script: |
docker tag $(image_id) yaoa/cloud-media-scripts:latest
docker push yaoa/cloud-media-scripts:latest
displayName: Deploy Latest
condition: and(eq(variables['System.PullRequest.IsFork'], 'False'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- script: |
docker tag $(image_id) yaoa/cloud-media-scripts:latest-develop
docker push yaoa/cloud-media-scripts:latest-develop
displayName: Deploy Develop
condition: and(eq(variables['System.PullRequest.IsFork'], 'False'), eq(variables['Build.SourceBranch'], 'refs/heads/dev*'))
- script: |
docker tag $(image_id) yaoa/cloud-media-scripts:$BUILD_SOURCEBRANCHNAME
docker push yaoa/cloud-media-scripts:$BUILD_SOURCEBRANCHNAME
displayName: Deploy Branch
condition: and(eq(variables['System.PullRequest.IsFork'], 'False'), startsWith(variables['Build.SourceBranch'], 'refs/heads/'))
- script: |
docker tag $(image_id) yaoa/cloud-media-scripts:$BUILD_SOURCEBRANCHNAME
docker push yaoa/cloud-media-scripts:$BUILD_SOURCEBRANCHNAME
displayName: Deploy Tag
condition: and(eq(variables['System.PullRequest.IsFork'], 'False'), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))