-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
71 lines (66 loc) · 2.02 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
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:18.16.0
# This folder is cached between builds
# https://docs.gitlab.com/ee/ci/yaml/index.html#cache
cache:
paths:
- node_modules/
# Stages
stages:
- build
- deploy
- export
# Install dependencies
build:
stage: build
script:
- npm install
# Convert all asciidoc files to the HTML format
# https://docs.asciidoctor.org/asciidoctor/latest/cli/
# Prepare artifacts for publishing
pages:
stage: deploy
script:
# generate HTML files from asciidoc
- npm run build *.adoc */*.adoc
# list of the result
- find . -type f -not -path '*/\.*' -not -path '*/node_modules/*' -name "*.html"
# prepare directory with resources for web
- mkdir .public
- cp -r javascripts .public
- cp -r stylesheets .public
- cp -r node_modules/reveal.js .public/javascripts
# copy all HTML files
- find . -type f -not -path '*/\.*' -not -path './node_modules/*' -not -path './common/*' -name "*.html" -exec cp --parents -t "./.public" {} +
# copy all images directories
- find . -type d -name "images" -not -path '*/\.*' -not -path './node_modules/*' -exec cp -r --parents -t "./.public" {} +
# rename to public, this is required for generate artifacts
- mv .public public
- ls -la ./public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
environment: production
export:
stage: export
image:
name: astefanutti/decktape:3.9
entrypoint: [""]
script:
- mkdir export
- echo "Prepare PDF files"
# generate PDF files from the HTML files
- |+
for file in $(find ./public -type f -not -path '*/\.*' -not -path './public/javascripts/*' -name "*.html")
do
node /decktape/decktape.js --chrome-path chromium-browser $file "./export/${file:9:length-5}.pdf"
done
artifacts:
paths:
- export
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
environment: production