forked from vinaygopinath/visa-req-wiki-scraper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis-push.sh
32 lines (26 loc) · 855 Bytes
/
.travis-push.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# Credit: https://gist.github.com/willprice/e07efd73fb7f13f917ea
setup_git() {
git config --global user.email "[email protected]"
git config --global user.name "Travis CI"
}
commit_country_json_files() {
git checkout master
dateAndMonth=`date "+%b %Y"`
git status
git add -f dist/output/*.json
git commit -m "Travis update: $dateAndMonth (Build $TRAVIS_BUILD_NUMBER)" -m "[skip ci]"
}
upload_files() {
git remote rm origin
git remote add origin https://vinaygopinath:${GH_TOKEN}@github.com/vinaygopinath/visa-req-wiki-scraper.git > /dev/null 2>&1
git push origin master --quiet > /dev/null 2>&1
}
setup_git
commit_country_json_files
if [ $? -eq 0 ]; then
echo "A new commit with changed country JSON files exists. Uploading to GitHub"
upload_files
else
echo "No changes in country JSON files. Nothing to do"
fi