-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path.gitlab-ci.yml
74 lines (69 loc) · 2.15 KB
/
.gitlab-ci.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
include:
- template: Auto-DevOps.gitlab-ci.yml
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .npm
- node_modules
variables:
AUTO_DEVOPS_BUILD_IMAGE_CNB_ENABLED: "true"
AUTO_DEVOPS_BUILD_IMAGE_CNB_BUILDER: "heroku/buildpacks:20"
npm_config_cache: "$CI_PROJECT_DIR/.npm"
build:
stage: build
image: "docker:19.03.12"
cache: {}
variables:
DOCKER_TLS_CERTDIR: ""
services:
- docker:19.03.12-dind
script:
- |
if [[ -z "$CI_COMMIT_TAG" ]]; then
export CI_APPLICATION_REPOSITORY=${CI_APPLICATION_REPOSITORY:-$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG}
export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_SHA}
else
export CI_APPLICATION_REPOSITORY=${CI_APPLICATION_REPOSITORY:-$CI_REGISTRY_IMAGE}
export CI_APPLICATION_TAG=${CI_APPLICATION_TAG:-$CI_COMMIT_TAG}
fi
- export image_tagged="$CI_APPLICATION_REPOSITORY:$CI_APPLICATION_TAG"
- export image_latest="$CI_APPLICATION_REPOSITORY:latest"
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- apk add --update curl tar
- (curl -sSL "https://github.com/buildpacks/pack/releases/download/v0.15.1/pack-v0.15.1-linux.tgz" | tar -C /usr/local/bin/ --no-same-owner -xzv pack)
- |
pack build "$image_tagged" \
--clear-cache \
--builder heroku/buildpacks:20 \
--buildpack registry.gitlab.com/upchieve/doppler-buildpack \
--buildpack heroku/nodejs \
--buildpack heroku/procfile
- docker tag "$image_tagged" "$image_latest"
- docker push "$image_tagged"
- docker push "$image_latest"
rules:
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
test:
stage: test
image: node:12.20.0-stretch
before_script:
- npm ci --cache .npm --prefer-offline
script:
- npm install
- npm run test
rules:
- if: '$TEST_DISABLED'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'
lint:
stage: test
image: node:12.20.0-stretch
before_script:
- npm ci --cache .npm --prefer-offline
script:
- npm install
- npm run lint:prod
rules:
- if: '$TEST_DISABLED'
when: never
- if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH'