-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpipeline-master.yml
113 lines (104 loc) · 3.06 KB
/
pipeline-master.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
resource_types:
- name: slack-notification
type: docker-image
source:
repository: cfcommunity/slack-notification-resource
resources:
- name: dashflow
type: git
source:
uri: https://github.com/freewheel/dashflow.git
branch: master
- name: slack
type: slack-notification
source:
url: ((slack-webhook-url))
jobs:
- name: lint
plan:
- get: dashflow
trigger: true
- task: run-lint
config:
platform: linux
image_resource:
type: docker-image
source: { repository: node, tag: 11 }
inputs:
- name: dashflow
run:
path: sh
args:
- -exc
- |
cd dashflow
yarn install --network-concurrency 1
yarn --silent lint
on_failure:
put: slack
params:
text: |
Lint failed for dashflow master branch(${ATC_EXTERNAL_URL}/builds/${BUILD_ID}), please investigate.
- name: test
plan:
- get: dashflow
trigger: true
- task: run-test
config:
platform: linux
image_resource:
type: docker-image
source: { repository: node, tag: 11 }
inputs:
- name: dashflow
run:
path: sh
args:
- -exc
- |
cd dashflow
yarn install --network-concurrency 1
yarn --silent test --no-color --verbose
on_failure:
put: slack
params:
text: |
Test failed for dashflow master branch(${ATC_EXTERNAL_URL}/builds/${BUILD_ID}), please investigate.
- name: publish-npm-package
plan:
- get: dashflow
trigger: true
passed:
- lint
- test
- task: publish-dev
config:
platform: linux
image_resource:
type: docker-image
source: { repository: node, tag: 11 }
inputs:
- name: dashflow
params:
NPM_PUBLISH_TOKEN: ((npm-publish-token))
run:
path: sh
args:
- -ec
- |
NPM_CURRENT_VERSION=$(npm view dashflow dist-tags.latest)
CODE_VERSION=$(cat dashflow/package.json | grep version | awk 'BEGIN { FS = "\"" }; { print $4 }')
if ! [ "$CODE_VERSION" = "$NPM_CURRENT_VERSION" ]; then
cd dashflow
yarn install --network-concurrency 1
echo "publishing dashflow package to npm"
echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}" > .npmrc
npm publish
else
echo "skip publishing since the version is the same as in npm registry"
fi
on_failure:
put: slack
params:
text: |
Publish failed for dashflow(${ATC_EXTERNAL_URL}/builds/${BUILD_ID}), please investigate.