-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
.gitlab-ci.yml
89 lines (85 loc) · 2.94 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
docker-build:
# Use the official docker image.
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- apk add yarn nodejs-current
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- |
if [ "$PRERENDER" = "true" ]; then yarn docker:build-noenv \
--build-arg REACT_APP_REPO_URL="https://${CI_SERVER_HOST}/${CI_PROJECT_PATH}" \
--build-arg REACT_APP_COMMIT_HASH="$CI_COMMIT_SHORT_SHA" \
--build-arg REACT_APP_COMMIT_MESSAGE="$CI_COMMIT_MESSAGE" \
--build-arg REACT_APP_VERSION="$(node -e 'console.log(require("package.json").version)')" \
--build-arg PRERENDER=true \
-t "$CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:full"; docker push "$CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:full"; exit 0; fi;
- |
yarn docker:build-noenv \
--build-arg REACT_APP_REPO_URL="https://${CI_SERVER_HOST}/${CI_PROJECT_PATH}" \
--build-arg REACT_APP_COMMIT_HASH="$CI_COMMIT_SHORT_SHA" \
--build-arg REACT_APP_COMMIT_MESSAGE="$CI_COMMIT_MESSAGE" \
--build-arg REACT_APP_VERSION="$(node -e 'console.log(require("package.json").version)')" \
-t "$CI_REGISTRY_IMAGE:latest" \
-t "$CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:latest" \
-t "$CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:$CI_COMMIT_SHORT_SHA";
- docker push "$CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:latest"
- docker push "$CI_REGISTRY_IMAGE/$CI_COMMIT_BRANCH:$CI_COMMIT_SHORT_SHA"
- if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker push "$CI_REGISTRY_IMAGE:latest"; fi;
# Run this job in a branch where a Dockerfile exists
rules:
- if: $CI_COMMIT_BRANCH && $PULL != "true"
exists:
- Dockerfile
pull:
image: alpine:latest
before_script:
- apk add git
- git checkout master
- git remote set-url origin https://actions-bot:$gitlab_token@$CI_SERVER_HOST/$CI_PROJECT_PATH
- git remote add hkbus https://github.com/hkbus/hk-independent-bus-eta || git remote set-url hkbus https://github.com/hkbus/hk-independent-bus-eta
- git config --global user.email "[email protected]"
- git config --global user.name "actions-bot"
- git config pull.rebase false
- git pull origin master
script:
- |
git fetch hkbus
git merge -X theirs hkbus/master -m "Pull upstream" --allow-unrelated-histories
git push origin --all
rules:
- if: $PULL == "true"
pages:
image: node:18
stage: deploy
script:
- yarn install
- yarn build
- cp build/index.html build/404.html
- mv build public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $PULL != "true"
stages:
- test
- build
- deploy
- review
- dast
- staging
- canary
- production
- incremental rollout 10%
- incremental rollout 25%
- incremental rollout 50%
- incremental rollout 100%
- performance
- cleanup
include:
- template: Auto-DevOps.gitlab-ci.yml
rules:
- if: $PULL != "true"