#!/bin/bash DIRECTORY=build # Install lunr to build the index npm install lunr@2.3.8 # Go to the directory... cd $DIRECTORY printf "Found the following build targets inside: \n$(ls -d */)\n\n" # ...and loop through all the build targets for branch in $(ls -d */); do echo "Entering: $branch"; cd "$branch"; echo "Generating the index..." cat documents.js | node $CI_PROJECT_DIR/build_index.js > index.js rm documents.js build_index.js echo "...should be completed. First 50 characters of the index: " cat index.js | head -c50 echo "" cd .. done rm $CI_PROJECT_DIR/build_index.js