-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure.yaml
85 lines (82 loc) · 2.77 KB
/
azure.yaml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
trigger:
branches:
include:
- refs/tags/v*
pr: none
stages:
- stage: Build
jobs:
- job: npm_job
continueOnError: false
pool:
vmImage: ubuntu-latest
strategy:
matrix:
node_12_x:
node_version: 12.x
maxParallel: 5
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: npm install
displayName: 'Install dependencies'
- bash: npm run lint
displayName: 'Lint code'
- bash: npm run build
displayName: 'Build code'
- bash: npm run test:ci
displayName: 'Test compiled code'
- job: yarn_job
continueOnError: false
pool:
vmImage: ubuntu-latest
strategy:
matrix:
node_12_x:
node_version: 12.x
maxParallel: 5
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js'
- bash: yarn install
displayName: 'Install dependencies'
- bash: yarn lint
displayName: 'Lint code'
- bash: yarn build
displayName: 'Build code'
- bash: yarn test:ci
displayName: 'Test compiled code'
- stage: Docker
jobs:
- job: docker_job
condition: succeeded('Build')
continueOnError: false
pool:
vmImage: ubuntu-latest
steps:
- script: |
echo '{ "experimental": true }' | sudo tee /etc/docker/daemon.json
sudo service docker restart
displayName: 'Enable Docker Engine experimental '
- script: |
GIT_TAG=`git describe --tags` && VERSION_TAG="$(cut -d'-' -f1 <<<"$GIT_TAG")" && echo "##vso[task.setvariable variable=VERSION_TAG]$VERSION_TAG"
displayName: 'Get Git Tag'
- task: Docker@0
displayName: 'Build an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryConnection: Docker # it is necessary to create a new "service connection" via Azure DevOps portal
dockerFile: ./Dockerfile
buildArguments: '--rm --squash'
imageName: '$(Build.Repository.Name):$(VERSION_TAG)'
- task: Docker@0
displayName: 'Push an image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryConnection: Docker # it is necessary to create a new "service connection" via Azure DevOps portal
action: 'Push an image'
imageName: '$(Build.Repository.Name):$(VERSION_TAG)'