Created
January 26, 2020 09:45
-
-
Save fahadahammed/32c8c211b6892e889c7909b7f05e8e3d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tmpFile="/tmp/jenkinsgitlabrokomarifilechanges.txt" | |
# All the files that changed in this build trigger to a temporary file | |
git diff --name-only $GIT_PREVIOUS_COMMIT $GIT_COMMIT > $tmpFile | |
# Which file extension to catch | |
to_find=".js .scss .css" | |
count=0 | |
for i in $(echo $to_find | sed 's| |\n|g'); | |
do | |
if grep -q "$i" "$File"; | |
then | |
echo "Got the files of type: \"*$i\""; | |
count=$(echo $count+1 | /usr/bin/bc); | |
else | |
echo "\"*$i\" Type Not Found"; | |
fi | |
done | |
echo $count; | |
if [ "$count" -gt 0 ]; | |
then | |
echo "Found more than 0: $count"; | |
echo "Running NPM"; | |
npm run build-production; | |
else | |
echo "Not Found"; | |
echo "Not running NPM"; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment