build.sh 644 B

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