forked from bonitasoft/bonita-documentation-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-preview.bash
executable file
·32 lines (27 loc) · 1.28 KB
/
build-preview.bash
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
#!/usr/bin/env bash
########################################################################################################################
# This script is intended to be used for documentation content repository PR preview published on public site
# Extra arguments are available to test it for local usage (dev environment, local file browsing, ....)
########################################################################################################################
set -euo pipefail
# if arguments contain '--ci false', don't run 'npm ci'
args="$@"
if [[ "$args" != *"--ci false"* ]]; then
echo "Assume script is running on CI environment"
echo "Using node $(node --version) and npm $(npm --version)"
npm ci
else
echo "Assume script is NOT running on CI environment"
fi
# See the node script for the list of arguments
node scripts/generate-doc-content-pr-preview-antora-playbook.js "$@"
echo "Building preview..."
rm -rf build/
extraAntoraArgs=
# if arguments contain '--type local', use html extension in urls
if [[ "$args" == *"--type local"* ]]; then
extraAntoraArgs="--html-url-extension-style default"
fi
echo "extra Antora Args: ${extraAntoraArgs}"
./node_modules/.bin/antora --stacktrace --fetch ${extraAntoraArgs} antora-playbook-doc-content-pr-preview.yml
echo "Preview built"