build.sh 662 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. # This script is executed by Travis CI for every successful push (on any branch, PR or not).
  3. set -ex
  4. function initialize {
  5. if [ -z "$TLDRHOME" ]; then
  6. export TLDRHOME=${TRAVIS_BUILD_DIR:-$(pwd)}
  7. fi
  8. export TLDR_ARCHIVE="tldr.zip"
  9. }
  10. function build_index {
  11. npm run build-index
  12. cp index.json pages/
  13. echo "Pages index succesfully built."
  14. }
  15. function build_archive {
  16. rm -f "$TLDR_ARCHIVE"
  17. cd "$TLDRHOME/"
  18. zip -q -r "$TLDR_ARCHIVE" pages* LICENSE.md index.json
  19. echo "Pages archive succesfully built."
  20. }
  21. ###################################
  22. # MAIN
  23. ###################################
  24. initialize
  25. build_index
  26. build_archive