-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
101 lines (93 loc) · 2.09 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
90
91
92
93
94
95
96
97
98
99
100
101
image: netroby/alpine-rsync
#project specific variables can be defines here, or overridden project settings
variables:
SERVER_DEV: ebi-cli.ebi.ac.uk
S3_BUCKET_DEV: origin.dev.ebi.emblstatic.net
SCRIPT_DEV: ~/bin/update-ebi-icon-fonts
DEV_URL: http://wwwdev.ebi.ac.uk/web_guidelines/EBI-Icon-fonts
SERVER_PROD: ebi-cli.ebi.ac.uk
S3_BUCKET_PROD: origin.ebi.emblstatic.net
SCRIPT_PROD: ~/bin/update-ebi-icon-fonts-prod
PROD_URL: http://www.ebi.ac.uk/web_guidelines/EBI-Icon-fonts
# do not define here, put in project variables
SSH_USER: username
SSH_KEY: secret-key
AWS_KEY: key
AWS_SECRET: secret-key
#setup ssh keys
.deploy_setup: &deploy_setup
tags:
- docker
before_script:
- mkdir ~/.ssh
- echo -e "${SSH_KEY}" >> ~/.ssh/${SSH_USER} && chmod 400 ~/.ssh/${SSH_USER}
- echo -e "Host *\n\tIdentityFile ~/.ssh/%r\n\tStrictHostKeyChecking no" >> ~/.ssh/config
stages:
- build
- deploy
build:
stage: build
image: ebiwd/node-fontforge-grunt:6
# https://github.com/ebiwd/dockerfile-node-fontforge-grunt/blob/master/Dockerfile
tags:
- docker
before_script:
- cd ${CI_PROJECT_DIR}
- npm install --quiet
script:
- grunt
cache:
paths:
- node_modules
artifacts:
paths:
- '*/fonts'
- '*/static'
- fonts.css
- partial.html
deploy_dev:
<<: *deploy_setup
stage: deploy
script:
- ssh -t ${SSH_USER}@${SERVER_DEV} ${SCRIPT_DEV}
only:
- branches
except:
- /-code$/
environment:
name: dev
url: ${DEV_URL}
deploy_live:
<<: *deploy_setup
stage: deploy
script:
- ssh -t ${SSH_USER}@${SERVER_PROD} ${SCRIPT_PROD}
only:
- tags
environment:
name: live
url: ${LIVE_URL}
deploy_aws_dev:
image: ebiwd/alpine-ssh
stage: deploy
tags:
- docker
before_script:
- add-aws-key ${AWS_KEY} ${AWS_SECRET}
script:
- bin/deploy-aws
only:
- branches
except:
- /-code$/
deploy_aws_live:
image: ebiwd/alpine-ssh
stage: deploy
tags:
- docker
before_script:
- add-aws-key ${AWS_KEY} ${AWS_SECRET}
script:
- bin/deploy-aws prod
only:
- tags