1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2024-10-30 15:57:57 +01:00
tldr/scripts/build.sh
Marco Bonelli a188a3a8ca Travis: separate building from deployment.
- Added `-q` to the zip command to create the archive since Travis
  was having trouble handling its very long output (thus making
  the build fail).
- Moved the actual building of the index and the archive from
  deploy.sh to a new build.sh script.
- Added a `script` step in .travis.yml to run build.sh after npm
  test.
- Specified a clone depth of 1 in .travis.yml to make things faster
  since we don't need to do any git operation during the build.
2019-07-11 17:01:05 +05:30

32 lines
639 B
Bash

#!/usr/bin/env bash
# This script is executed by Travis CI for every successful push (on any branch, PR or not).
set -ex
function initialize {
if [ -z "$TLDRHOME" ]; then
export TLDRHOME=${TRAVIS_BUILD_DIR:-$(pwd)}
fi
export TLDR_ARCHIVE="tldr.zip"
}
function build_index {
npm run build-index
echo "Pages index succesfully built."
}
function build_archive {
rm -f "$TLDR_ARCHIVE"
cd "$TLDRHOME/"
zip -q -r "$TLDR_ARCHIVE" pages* LICENSE.md index.json
echo "Pages archive succesfully built."
}
###################################
# MAIN
###################################
initialize
build_index
build_archive