-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
135 lines (99 loc) · 3.22 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
image: ruby:2.3
stages:
- test
- deploy
variables:
OUT_DIR: build
STAGING_URL: $CI_COMMIT_REF_NAME-$CI_PROJECT_NAME-$CI_PROJECT_NAMESPACE.surge.sh
build:
stage: test
except:
- master
cache:
paths:
- vendor/ruby
script:
- ruby -v
- apt-get update
- apt-get install -y locales
- echo "en_US UTF-8" > /etc/locale.gen
- locale-gen en_US.UTF-8
- export LANG=en_US.UTF-8
- export LANGUAGE=en_US:en
- export LC_ALL=en_US.UTF-8
- apt-get install -y zlib1g-dev
- gem install jekyll bundler
- bundle install --path vendor
- 'echo "url: https://$STAGING_URL" > userconfig.yml'
- 'echo "baseurl: \"\"" >> userconfig.yml'
- echo "Additional Jekyll config used for CI:" && cat userconfig.yml
- bundle exec jekyll build -d $OUT_DIR --config _config.yml,userconfig.yml --verbose --trace
artifacts:
paths:
- $OUT_DIR
# This deploys feature branches to https://surge.sh, a free static site hosting service.
# See CONTRIBUTING.md for details of how to configure your GitLab project to enable this.
# Ideally we would use GitLab pages for this, but until they suupport deploying feature
# branches alongside master branches (https://gitlab.com/gitlab-org/gitlab-pages/issues/33)
# this is the next best option.
preview:
stage: deploy
except:
- master
# This is allowed to fail because only those who have setup $SURGE_LOGIN and $SURGE_TOKEN
# as GitLab secret variables (see CONTRIBUTING.md) are able to preview like this.
allow_failure: true
image: node:wheezy
script:
- npm install -g surge
- surge --project $OUT_DIR --domain $STAGING_URL
environment:
# Should ideally use $STAGING_URL here, but seems custom variables aren't supported.
url: https://$CI_COMMIT_REF_NAME-$CI_PROJECT_NAME-$CI_PROJECT_NAMESPACE.surge.sh
name: review/$CI_COMMIT_REF_NAME
on_stop: teardown_preview
teardown_preview:
stage: deploy
except:
- master
variables:
GIT_STRATEGY: none
when: manual
# This is allowed to fail because only those who have setup $SURGE_LOGIN and $SURGE_TOKEN
# as GitLab secret variables (see CONTRIBUTING.md) are able to preview like this.
allow_failure: true
image: node:wheezy
script:
- npm install -g surge
- surge teardown $STAGING_URL
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
pages:
stage: deploy
only:
- master
cache:
paths:
- vendor/ruby
script:
- ruby -v
- apt-get update
- apt-get install -y locales
- echo "en_US UTF-8" > /etc/locale.gen
- locale-gen en_US.UTF-8
- export LANG=en_US.UTF-8
- export LANGUAGE=en_US:en
- export LC_ALL=en_US.UTF-8
- apt-get install -y zlib1g-dev
- gem install jekyll bundler
- bundle install --path vendor
# This is where GitLab pages will deploy to by default (e.g. "https://fdroid.gitlab.io/fdroid-website")
# so we need to make sure that the Jekyll configuration understands this.
- 'echo url: https://$CI_PROJECT_NAMESPACE.gitlab.io > userconfig.yml'
- 'echo baseurl: /$CI_PROJECT_NAME >> userconfig.yml'
- echo "Additional Jekyll config used for CI:" && cat userconfig.yml
- bundle exec jekyll build -d public --config _config.yml,userconfig.yml
artifacts:
paths:
- public