-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
48 lines (39 loc) · 1.34 KB
/
deploy.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -o errexit -o nounset
BASE_REPO=$PWD
setup_git() {
Rscript -e 'source("R/rladies.R")'
Rscript -e 'source("R/rladies_hosts.R")'
Rscript -e 'source("R/rugs.R")'
git config --global user.name "benubah"
git config --global user.email "ben@rpowerlabs.org"
}
commit_files() {
git checkout master
# Current month and year, e.g: May 2019
dateAndMonth=`date "+%b %Y"`
# Stage the modified files in dist/output
git add -f docs/data/rladies.csv
git add -f docs/data/rladies_hosts.csv
git add -f docs/data/rladies_summary.json
git add -f docs/data/rladies_cumulative.json
git add -f docs/data/rladies_map_data.geojson
git add -f docs/data/rugs.csv
git add -f docs/data/rugs_summary.json
git add -f docs/data/rugs_cumulative.json
git add -f docs/data/rugs_map_data.geojson
# Create a new commit with a custom build message
# with "[skip ci]" to avoid a build loop
# and Travis build number for reference
git commit -m "Travis Cron Jobs Update: $dateAndMonth (Build $TRAVIS_BUILD_NUMBER)" -m "[skip ci]"
}
upload_files() {
# Remove existing "origin"
git remote rm origin
# Add new "origin" with access token in the git URL for authentication
git remote add origin https://${GITHUB_PAT}@github.com/${TRAVIS_REPO_SLUG}.git > /dev/null 2>&1
git push origin master --quiet
}
setup_git
commit_files
upload_files