From 6f0a866042f4b8e0c26826fb628b5196ee8ac647 Mon Sep 17 00:00:00 2001 From: Jakob Voss Date: Mon, 11 Nov 2019 11:06:05 +0100 Subject: [PATCH] Conditionally build PDF manual (#435) --- .travis.yml | 19 ++++++++++++------- build/build.sh | 10 +++++++--- docs/Makefile | 4 ++++ package.json | 3 ++- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index de44b0a5f..e9e678f13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,13 +10,18 @@ cache: - "$HOME/.npm" - "$HOME/.local" -before_install: >- # install Pandoc into ~/.local for document generation - mkdir -p "$HOME/.local/bin"; - if [[ ! -f "$HOME/.local/bin/pandoc" ]]; then - curl -L https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb > pandoc.deb && - dpkg -x pandoc.deb pandoc && cp pandoc/usr/bin/* $HOME/.local/bin - fi; - export PATH="$HOME/.local/bin:$PATH" +before_install: + - >- # install Pandoc into ~/.local for document generation + mkdir -p "$HOME/.local/bin"; + if [[ ! -f "$HOME/.local/bin/pandoc" ]]; then + curl -L https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb > pandoc.deb && + dpkg -x pandoc.deb pandoc && cp pandoc/usr/bin/* $HOME/.local/bin + fi; + export PATH="$HOME/.local/bin:$PATH" + - >- # install LaTeX only if last commit modified something in docs/ + if [[ $(git show --pretty="" --name-only HEAD docs/) ]]; then + sudo apt-get install texlive-xetex texlive-fonts-recommended lmodern rsvg-convert + fi install: - npm i -g npm@5.10.0 diff --git a/build/build.sh b/build/build.sh index f7c4af86c..93079434a 100755 --- a/build/build.sh +++ b/build/build.sh @@ -53,10 +53,14 @@ else fi # create and move user manual -echo "Creating user manual..." -npm run user-manual -cp docs/*/user-manual-*.html dist/ +echo "Creating user manual (HTML)..." +npm run manual echo +if [ $(git show --pretty="" --name-only HEAD docs/) ]; then + echo "Creating user manual (PDF)..." + npm run manual-pdf +fi +cp docs/*/user-manual-*.{html,pdf} dist/ # # delete config file if it was generated during this script [ ! $USERCONFIG ] && echo "Removing config generated during build..." && rm ./config/cocoda.json diff --git a/docs/Makefile b/docs/Makefile index 54ef9f1e0..1549adc18 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -10,6 +10,10 @@ all: $(BUILD_INFO) make -C en make -C de +pdfs: $(BUILD_INFO) + make -C en pdf + make -C de pdf + $(BUILD_INFO): npm run build-info diff --git a/package.json b/package.json index f1837ebf7..670a87d9d 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "styleguide": "vue-styleguidist server", "styleguide:build": "vue-styleguidist build", "build-info": "./build/build-info.sh > ./build/build-info.json", - "user-manual": "make -BC docs", + "manual": "make -BC docs", + "manual-pdf": "make -BC docs pdf", "release": "./bin/release.sh", "kos-types": "wget http://api.dante.gbv.de/voc/top?uri=http://w3id.org/nkos/nkostype -O config/kos-types.json" },