forked from RocketChat/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
85 lines (82 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
stages:
- build
Fetch Translation:
stage: build
rules:
- allow_failure: false
when: manual
image: debian:stable-slim
before_script:
- apt update -qy
- apt install -y curl jq git
- git config --global user.email 'automator@gitlab.pdis.dev'
- git config --global user.name 'CrowdinTranslation'
- git checkout "$CI_COMMIT_REF_NAME"
- git remote set-url origin $( echo ${CI_REPOSITORY_URL} | sed -E "s/gitlab-ci-token:[^@]+/gitlab-ci-token:${GITLAB_TOKEN}/" )
script:
- |
ZH_TW_FILE=$(curl https://crowdin.com/api/v2/projects/${CROWDIN_PROJECT_ID}/translations/builds/files/${CROWDIN_FILE_ID}\
-X POST \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer ${CROWDIN_PERSONAL_TOKEN}" \
--data '{"targetLanguageId": "zh-TW"}' \
| jq -r '.data.url')
curl $ZH_TW_FILE -o packages/rocketchat-i18n/i18n/zh-TW.i18n.json
if [ "$(git diff --exit-code)" ]; then
git add packages/rocketchat-i18n/i18n/zh-TW.i18n.json
echo '[Auto] Fetch translation string from Crowdin' | git commit -F -
git push origin "${CI_COMMIT_REF_NAME}" -o ci.skip
else
echo 'there is no changes.'
fi
Build Service Bundle:
stage: build
rules:
- allow_failure: false
when: manual
image: debian:stable-slim
variables:
METEOR_ALLOW_SUPERUSER: "1"
before_script:
- apt update -qy
- apt install -y curl g++ build-essential python-dev tar git
- curl -fsSL https://deb.nodesource.com/setup_12.x | bash -
- apt install -y nodejs
script:
- curl https://install.meteor.com | sh
- echo 'Show environment matrix'
- |
npm --versions
node -v
meteor --version
meteor npm --version
meteor node -v
- meteor npm install
- meteor npm run lint
- npx browserslist@latest --update-db
- |
WORKDIR="$(pwd)"
mkdir "$WORKDIR/PDIS-flavor/build"
meteor build --verbose --server-only --directory "$WORKDIR/PDIS-flavor/build"
cd "$WORKDIR/PDIS-flavor/build"
tar czf "Rocket.Chat.PDIS-flavor.${CI_COMMIT_BRANCH}.${CI_COMMIT_SHORT_SHA}.tar.gz" bundle
mv "$WORKDIR/PDIS-flavor/Rocket.Chat.PDIS-flavor.${CI_COMMIT_BRANCH}.${CI_COMMIT_SHORT_SHA}.tar.gz" ../../
artifacts:
paths:
- Rocket.Chat.PDIS-flavor.${CI_COMMIT_BRANCH}.${CI_COMMIT_SHORT_SHA}.tar.gz
- PDIS-flavor/build
Build Docker Image:3.18:
stage: build
rules:
- if: "$CI_COMMIT_REF_NAME =~ /pdis$/"
when: manual
dependencies:
- Build Service Bundle
image: docker
before_script:
- docker login registry.gitlab.pdis.dev -u gitlab-ci-token -p ${GITLAB_REGISTRY_TOKEN}
script:
- |
cd PDIS-flavor
docker build -t registry.gitlab.pdis.dev/web-application/rocket.chat:${CI_COMMIT_BRANCH}-${CI_COMMIT_SHOR_SHA} .
- docker push registry.gitlab.pdis.dev/web-application/rocket.chat:${CI_COMMIT_BRANCH}-${CI_COMMIT_SHOR_SHA}