-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
54 lines (51 loc) · 1.55 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
52
53
54
trigger:
- master
pr:
- master
resources:
- repo: self
stages:
- stage: Build
displayName: Build & QA
condition: ne(variables['Build.SourceBranch'], 'refs/heads/master')
jobs:
- job: Build
displayName: Build
pool:
vmImage: ubuntu-latest
steps:
- task: Bash@3
displayName: Build docker image
inputs:
targetType: 'inline'
script: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker build .
env: #provide secrets this way to have them available as an environment variable in a secure way
DOCKER_PASSWORD: $(DOCKER_PASSWORD)
- stage: Release
displayName: Release a new image on Dockerhub
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
jobs:
- job: Build
displayName: Build Docker & Release to DockerHub
pool:
vmImage: ubuntu-latest
steps:
- task: Npm@1
inputs: # Ensure that the semantic-release tool is installed as specified in the package.json
command: 'install'
- task: Bash@3
inputs:
targetType: 'inline'
script: |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker build . -t opencv-dotnet-runtime-deps
npx semantic-release
env:
GH_TOKEN: $(GH_TOKEN)
DOCKER_PASSWORD: $(DOCKER_PASSWORD)
DOCKER_USERNAME: $(DOCKER_USERNAME)
DOCKER_USER: $(DOCKER_USERNAME)
DOCKER_REGISTRY_USER: $(DOCKER_USERNAME)
DOCKER_REGISTRY_PASSWORD: $(DOCKER_PASSWORD)