1
0

build.sh 677 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. # SPDX-License-Identifier: MIT
  3. # This script is executed by GitHub Actions for every successful push (on any branch, PR or not).
  4. set -ex
  5. function initialize {
  6. if [ -z "$TLDRHOME" ]; then
  7. export TLDRHOME=${GITHUB_WORKSPACE:-$(pwd)}
  8. fi
  9. export TLDR_ARCHIVE="tldr.zip"
  10. }
  11. function build_index {
  12. npm run build-index
  13. echo "Pages index successfully 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 successfully built."
  20. }
  21. ###################################
  22. # MAIN
  23. ###################################
  24. initialize
  25. build_index
  26. build_archive