-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwercker.yml
91 lines (89 loc) · 2.62 KB
/
wercker.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
box: node:7.8.0
build-assets:
steps:
- script:
name: export tag environment variable
code: |
export BUILD_TAG=assets-${WERCKER_GIT_COMMIT:0:9}
echo "build tag is $BUILD_TAG"
echo $BUILD_TAG > .build-tag
echo "exported as environment variable and to .build-tag"
- script:
name: export environment
code: |
export NODE_ENV=production
export NPM_CONFIG_LOGLEVEL=warn
- script:
name: set yarn cache
code: |
export YARN_CACHE=$WERCKER_CACHE_DIR/yarn
- script:
name: run yarn
cwd: client/
code: |
HOME=$YARN_CACHE yarn install --no-optional
- script:
name: run webpack
cwd: client/
code: |
npm run webpack:prod
- script:
name: copy to volume
cwd: client/
code: |
cp -a -v ./build /assets
- internal/docker-push:
username: $DOCKER_REGISTRY_USERNAME
password: $DOCKER_REGISTRY_PASSWORD
repository: turistforeningen/asgardr
registry: https://registry.hub.docker.com/v2
tag: $BUILD_TAG
after-steps:
- turistforeningen/slack-pipeline-notifier:
url: $SLACK_WEBHOOK_URL
pipeline: build-assets
build-server:
steps:
- script:
name: export tag environment variable
code: |
export BUILD_TAG=server-${WERCKER_GIT_COMMIT:0:9}
echo "build tag is $BUILD_TAG"
- script:
name: echo nodejs information
code: |
echo "node version $(node -v) running"
echo "npm version $(npm -v) running"
echo "npm registry $(npm config get registry)"
- script:
name: set yarn cache
code: |
export YARN_CACHE=$WERCKER_CACHE_DIR/yarn
- script:
name: run yarn
cwd: server/
code: |
HOME=$YARN_CACHE yarn
- script:
name: write tag file
cwd: server/
code: |
echo "writing $BUILD_TAG to .tag"
echo $BUILD_TAG > .tag
- script:
name: write gitcommit file
cwd: server/
code: |
echo "writing $WERCKER_GIT_COMMIT to .gitcommit"
echo $WERCKER_GIT_COMMIT > .gitcommit
- internal/docker-push:
username: $DOCKER_REGISTRY_USERNAME
password: $DOCKER_REGISTRY_PASSWORD
repository: turistforeningen/asgardr
registry: https://registry.hub.docker.com/v2
tag: $BUILD_TAG
working-dir: /pipeline/source/server
after-steps:
- turistforeningen/slack-notifier:
url: $SLACK_WEBHOOK_URL
pipeline: build-server