-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy path.gitlab-pages.yml
69 lines (67 loc) · 2.48 KB
/
.gitlab-pages.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
# This file is part of Adblock Plus <https://adblockplus.org/>,
# Copyright (C) 2006-present eyeo GmbH
#
# Adblock Plus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# Adblock Plus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
#
# Synopsis:
#
# When included in a root GitLab CI configuration, the following jobs will
# take care of creating and publishing branched (master / next) contents of the
# project's GitLab Pages (https://docs.gitlab.com/ee/user/project/pages/).
#
# In your root CI configuration, define a hidden job `.pages` with all content
# generating jobs from prior stages listed in `dependencies`.
# Additionaly, define the `stage:` parameter with a valid stage.
#
# Note: Each prior job's content must be put in a unique directory, which
# should be listed as that job's artifact
#
# The resulting url of the GitLab pages will be generated as follows:
# <user>.gitlab.io/<project>/<branch>/<artifact directory>/
# E.g. for an artifact directory `docs` from `master` in
# `eyeo/adblockplus/adblockpluschrome`:
#
# eyeo.gitlab.io/adblockpluschrome/master/docs/
---
pages:
extends: .pages
variables:
MASTER_ARTIFACT_URL: "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/artifacts/master/download?job=pages"
NEXT_ARTIFACT_URL: "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/artifacts/next/download?job=pages"
script:
- "UPDATES=docs"
- echo $UPDATES
- "mkdir public"
# preserve the most recent public pages
- "wget -q $MASTER_ARTIFACT_URL -O master.zip &&
unzip -q master.zip -d master &&
mv -t public master/public/master || true"
- "wget -q $NEXT_ARTIFACT_URL -O next.zip &&
unzip -q next.zip -d next &&
mv -t public next/public/next || true"
# Update this branch's public page
- mkdir -p public/$CI_COMMIT_REF_NAME
- |
for PART in $UPDATES
do
echo "Updating $PART"
rm -rf public/$CI_COMMIT_REF_NAME/$PART
mv build/$PART public/$CI_COMMIT_REF_NAME/
done
resource_group: pages
artifacts:
paths:
- "public"
only:
- "master"
- "next"