-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
85 lines (68 loc) · 1.88 KB
/
.gitlab-ci.yml
File metadata and controls
85 lines (68 loc) · 1.88 KB
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
image: docker:latest
services:
- docker:dind
stages:
- test
- publish
- release
cache:
paths:
- node_modules/
before_script:
- apk update
- apk add jq yarn
- yarn install
test:
stage: test
script:
- yarn run test
publish:npm:
stage: publish
only:
- /v\d*\.\d*\.\d*/
except:
- branches
script:
# build the package
- yarn run build:all
# publish on npm
- echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
- npm publish --access=public
release:docker.io:
stage: release
only:
- /v\d*\.\d*\.\d*/
except:
- branches
script:
# build the package
- yarn run build:all
# export the current version from package.json into a variable
- export PACKAGE_VERSION=$(cat package.json | jq -r .version)
# login to official docker registry
- docker login -u "$DOCKER_REGISTRY_USER" -p "$DOCKER_REGISTRY_PASSWORD"
# push tagged with version
# - docker build --pull -t "$DOCKER_REGISTRY_IMAGE:$PACKAGE_VERSION" .
# - docker push "$DOCKER_REGISTRY_IMAGE:$PACKAGE_VERSION"
# push tagged with latest
- docker build --pull -t "$DOCKER_REGISTRY_IMAGE" .
- docker push "$DOCKER_REGISTRY_IMAGE"
release:gitlab:
stage: release
only:
- /v\d*\.\d*\.\d*/
except:
- branches
script:
# build the package
- yarn run build:all
# export the current version from package.json into a variable
- export PACKAGE_VERSION=$(cat package.json | jq -r .version)
# publish on the official docker hub registry
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# push tagged with version
# - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
# - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
# push tagged with latest
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"