-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
89 lines (85 loc) · 3.68 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
89 lines (85 loc) · 3.68 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
86
87
88
89
staging_package:
stage: build
image: node:16-bullseye-slim
environment:
name: staging
script:
- apt update
- apt install -y bzip2 git
# - git config --global credential.helper store
# - echo "https://$GITLAB_DEPLOY_TOKEN_USER:$GITLAB_DEPLOY_TOKEN_PASSWORD@gitlab.com" > ~/.git-credentials
# # If no .npmrc is included in the repo, generate a temporary one that is configured to install from GitLab's NPM registry
# - |
# if [[ ! -f .npmrc ]]; then
# echo 'No .npmrc found! Creating one now. Please review the following link for more information: https://docs.gitlab.com/ee/user/packages/npm_registry/index.html#project-level-npm-endpoint-1'
# {
# echo "@${CI_PROJECT_ROOT_NAMESPACE}:registry=${CI_API_V4_URL}/packages/npm/"
# echo "${CI_API_V4_URL#http*:}/packages/npm/:_authToken=\${CI_JOB_TOKEN}"
# } >> .npmrc
# fi
- CI=false && npm i --include=dev
# - cd node_modules/@peermetrics/webrtc-stats && npm install && npm run build && cd ../../..
- CI=false npm run build
- cd build
- tar -cjSf webrtc-dashboard.tar.bz2 *
artifacts:
paths:
- build/webrtc-dashboard.tar.bz2
only:
- master
before_script:
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
staging_deploy:
stage: deploy
image: kroniak/ssh-client
environment:
name: staging
script:
- scp -o StrictHostKeyChecking=no build/webrtc-dashboard.tar.bz2 $STAGING_SSH_USER@$STAGING_SSH_HOST:/var/www/webrtc-dashboard/releases/
- ssh $STAGING_SSH_USER@$STAGING_SSH_HOST "cd /var/www/webrtc-dashboard/releases && mkdir $CI_PIPELINE_ID && tar -xf webrtc-dashboard.tar.bz2 -C $CI_PIPELINE_ID"
- ssh $STAGING_SSH_USER@$STAGING_SSH_HOST "cd /var/www/webrtc-dashboard && ln -sfn releases/$CI_PIPELINE_ID current"
only:
- master
production_package:
stage: build
image: node:16-bullseye-slim
environment:
name: production
script:
- apt update
- apt install -y bzip2 git
# - git config --global credential.helper store
# - echo "https://$GITLAB_DEPLOY_TOKEN_USER:$GITLAB_DEPLOY_TOKEN_PASSWORD@gitlab.com" > ~/.git-credentials
# # If no .npmrc is included in the repo, generate a temporary one that is configured to install from GitLab's NPM registry
# - |
# if [[ ! -f .npmrc ]]; then
# echo 'No .npmrc found! Creating one now. Please review the following link for more information: https://docs.gitlab.com/ee/user/packages/npm_registry/index.html#project-level-npm-endpoint-1'
# {
# echo "@${CI_PROJECT_ROOT_NAMESPACE}:registry=${CI_API_V4_URL}/packages/npm/"
# echo "${CI_API_V4_URL#http*:}/packages/npm/:_authToken=\${CI_JOB_TOKEN}"
# } >> .npmrc
# fi
- CI=false && npm i --include=dev
# - cd node_modules/@peermetrics/webrtc-stats && npm install && npm run build && cd ../../..
- CI=false npm run build
- cd build
- tar -cjSf webrtc-dashboard.tar.bz2 *
artifacts:
paths:
- build/webrtc-dashboard.tar.bz2
only:
- tags
production_deploy:
stage: deploy
image: kroniak/ssh-client
environment:
name: production
script:
- scp -o StrictHostKeyChecking=no build/webrtc-dashboard.tar.bz2 $PRODUCTION_SSH_USER@$PRODUCTION_SSH_HOST:/var/www/webrtc-dashboard/releases/
- ssh $PRODUCTION_SSH_USER@$PRODUCTION_SSH_HOST "cd /var/www/webrtc-dashboard/releases && mkdir $CI_PIPELINE_ID && tar -xf webrtc-dashboard.tar.bz2 -C $CI_PIPELINE_ID"
- ssh $PRODUCTION_SSH_USER@$PRODUCTION_SSH_HOST "cd /var/www/webrtc-dashboard && ln -sfn releases/$CI_PIPELINE_ID current"
only:
- tags