-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
98 lines (93 loc) · 2.76 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
image: registry.gitlab.cobalt.rocks/cobalt/docker-builder/coderdojo-zola-builder:latest
cache:
key: '${CI_COMMIT_REF_SLUG}'
paths:
- node_modules
- public
Lint:
only:
changes:
- .gitlab-ci.yml
- 'content/*'
- 'content/*/*'
- 'content/*/*/*'
- 'sass/*'
- 'static/*'
- 'static/*/*'
- 'static/*/*/*'
- 'templates/*'
- 'templates/*/*'
- 'ts/*'
- chapter.toml
- config.toml
- package.json
- purgecss.config.js
- webpack.config.js
- webpack.prod.config.js
before_script:
- yarn install --non-interactive --check-files --frozen-lockfile
script:
- yarn dev:lint
.template: &rs-deploy
only:
changes:
- 'content/*'
- 'content/*/*'
- 'content/*/*/*'
- 'sass/*'
- 'static/*'
- 'static/*/*'
- 'static/*/*/*'
- 'templates/*'
- 'templates/*/*'
- 'ts/*'
- chapter.toml
- config.toml
- package.json
- purgecss.config.js
- webpack.config.js
- webpack.prod.config.js
- .gitlab-ci.yml
refs:
- main
before_script:
# Install all yarn dependencies (normally cached but clover#2 currently has problems with space)
- yarn install --non-interactive --check-files --frozen-lockfile
# Add shh folder
- mkdir -p ~/.ssh
# Start ssh agent
- eval $(ssh-agent -s)
# Dump keys from CI variables to files
- echo "$KEY" > ~/.ssh/id_rsa
- echo "$CD_HOST_KEY" >> ~/.ssh/known_hosts
# SSH agent requires specific permissions
- chmod 644 ~/.ssh/known_hosts
- chmod 700 ~/.ssh
- chmod 600 ~/.ssh/id_rsa
script:
- yarn ci:domain
- yarn ci:build
after_script:
# Restart agent - Not necessary for prod only needed for debugging
# - PID=$(eval "$(ssh-agent -s)" | sed "s/[A-Za-z ]*//") kill -9 "$PID"
# Upload
- rsync -e "ssh -p $CD_DIST_PORT -i ~/.ssh/id_rsa" -PL -rvzuc
--delete ./public/* "$CD_DIST_USER@$CD_DIST_HOST:"
CD:Red-Alternate:
<<: *rs-deploy
stage: deploy
environment:
name: production-old-1
url: https://old.coderdojo.red
variables:
DOMAIN: old.coderdojo.red
KEY: '$CD_RED_OLD_PRIVATE_KEY'
CD:Blue-Alternate:
<<: *rs-deploy
stage: deploy
environment:
name: production-old-2
url: https://old.coderdojo.blue
variables:
DOMAIN: old.coderdojo.blue
KEY: '$CD_BLUE_OLD_PRIVATE_KEY'