-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
39 lines (31 loc) · 1.01 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
#!/bin/bash
set -o errexit -o nounset
BASE_REPO=$PWD
setup_git() {
Rscript -e 'source("R/satrdays.R")'
Rscript -e 'source("R/r_cal.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/satrdays.json
git add -f docs/data/rugs_events.json
# 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