-
Notifications
You must be signed in to change notification settings - Fork 36
/
azure-pipelines.yml
124 lines (118 loc) · 3.56 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
variables:
NODE_JS_VERSION: 10.15.0
trigger:
branches:
include:
- master
- azure/*
tags:
include:
- v*
jobs:
- job: test_augur_node
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_JS_VERSION)
- bash: |
set -euo pipefail
yarn
npm run build:ts
npm run lint
npm run test
displayName: 'lint, test, and build'
- job: deploy_augur_node
dependsOn:
- test_augur_node
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_JS_VERSION)
- task: Docker@1
displayName: docker login
inputs:
command: login
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- bash: |
set -euxo pipefail
yarn
npm run docker:release -- dev
displayName: docker release dev
env:
AWS_ACCESS_KEY_ID: $(AWS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_KEY)
- task: Docker@1
displayName: docker logout
inputs:
command: logout
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
condition: |
and
(
succeeded(),
eq(variables['Build.SourceBranch'], 'refs/heads/master')
)
- job: tag_build
displayName: build tag
dependsOn:
- test_augur_node
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_JS_VERSION)
- task: Docker@1
displayName: docker login
inputs:
command: login
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- bash: |
set -euo pipefail
current_tag=$(git describe --exact-match --tags)
if [[ -n $current_tag ]]; then
echo "${current_tag}"
LATEST_VERSION_REGEX="^[vV]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
DEV_VERSION_REGEX="^[vV]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
if [[ $current_tag =~ $LATEST_VERSION_REGEX ]]; then
echo "##vso[task.setvariable variable=npm_tag]latest"
yarn
npm run docker:release -- latest
elif [[ $current_tag =~ $DEV_VERSION_REGEX ]]; then
echo "##vso[task.setvariable variable=npm_tag]dev"
else
# we should never get here
echo "tag ${current_tag} doesn't match semver"
echo "##vso[task.setvariable variable=npm_tag]random"
fi
fi
env:
AWS_ACCESS_KEY_ID: $(AWS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_KEY)
displayName: set npm tag and release
- task: Docker@1
displayName: docker logout
inputs:
command: logout
containerRegistryType: Container Registry
dockerRegistryEndpoint: dockerhub-augurproject
- bash: |
set -euo pipefail
yarn
yarn build
- task: Npm@1
inputs:
command: 'custom' # Options: install, publish, custom
verbose: true
customCommand: publish --tag $(npm_tag)
customRegistry: 'useNpmrc'
customEndpoint: npmjs-augur-integration
condition: |
and
(
succeeded(),
startsWith(variables['build.sourceBranch'], 'refs/tags/v')
)