Files
public-apis/build/main.sh
T

54 lines
1.4 KiB
Bash
Raw Normal View History

2017-07-10 01:01:47 -04:00
#!/bin/bash
2017-07-26 22:38:17 -04:00
FORMAT_FILE=../README.md
2017-07-26 22:38:17 -04:00
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo "running on $TRAVIS_BRANCH branch"
LINK_FILE=../README.md
else
echo "running on Pull Request #$TRAVIS_PULL_REQUEST"
2017-07-26 11:02:27 -04:00
DIFF_URL="https://patch-diff.githubusercontent.com/raw/toddmotto/public-apis/pull/$TRAVIS_PULL_REQUEST.diff"
2017-07-26 11:44:59 -05:00
curl $DIFF_URL > diff.txt
2017-07-26 11:02:27 -04:00
echo "------- BEGIN DIFF -------"
cat diff.txt
echo "-------- END DIFF --------"
cat diff.txt | egrep "\+" > additions.txt
echo "------ BEGIN ADDITIONS -----"
2017-07-21 14:51:23 -04:00
cat additions.txt
2017-07-26 11:02:27 -04:00
echo "------- END ADDITIONS ------"
LINK_FILE=additions.txt
fi
2017-10-26 11:14:21 -04:00
echo "checking if /json was changed..."
egrep "\+{3}\s.\/json\/" 527.diff > json.txt
if [[$? == 0]]; then
echo "JSON files are auto-generated! Please do not update these files:"
cat json.txt
exit 1
else
echo "/json check passed!"
rm json.txt
fi
2017-07-10 01:41:50 -04:00
echo "running format validation..."
./validate_format.rb $FORMAT_FILE
if [[ $? != 0 ]]; then
echo "format validation failed!"
2017-07-12 12:10:26 -04:00
exit 1
2017-07-10 01:41:50 -04:00
else
echo "format validation passed!"
2017-08-08 21:33:06 -04:00
./build.sh && ./deploy.sh
2017-08-08 21:30:47 -04:00
if [[ $? != 0 ]]; then
echo "JSON build and deploy failed!"
else
echo "JSON build and deploy success!"
fi
2017-07-10 01:41:50 -04:00
fi
2017-07-23 18:27:14 -04:00
echo "running link validation..."
./validate_links.rb $LINK_FILE
if [[ $? != 0 ]]; then
echo "link validation failed!"
exit 1
else
echo "link validation passed!"
2017-07-10 01:01:47 -04:00
fi