mirror of
https://github.com/zhigang1992/probot.github.io.git
synced 2026-01-12 22:49:53 +08:00
Use Travis CI cron to sync changes
This commit is contained in:
4
script/cibuild
Executable file
4
script/cibuild
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
script/test
|
||||
script/remote-sync
|
||||
@@ -1,26 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run script/sync-data and push changes.
|
||||
|
||||
set -x # print commands before execution
|
||||
set -o errexit # always exit on error
|
||||
set -o pipefail # honor exit codes when piping
|
||||
set -o nounset # fail on unset variables
|
||||
|
||||
# expected environment variables
|
||||
# GIT_AUTHOR_NAME
|
||||
# GIT_AUTHOR_EMAIL
|
||||
|
||||
REPOSITORY=https://github.com/probot/probot.github.io.git
|
||||
|
||||
rm -rf work
|
||||
git clone --depth=1 $REPOSITORY work
|
||||
cd work
|
||||
script/bootstrap
|
||||
echo "===> Syncing data"
|
||||
script/sync-data
|
||||
|
||||
git diff-index --quiet HEAD -- || {
|
||||
git add .
|
||||
git diff --quiet || {
|
||||
echo "===> Committing and pushing changes"
|
||||
git commit -am "Sync data"
|
||||
git push origin master --follow-tags
|
||||
}
|
||||
|
||||
rm -rf work
|
||||
REPO=`git config remote.origin.url`
|
||||
|
||||
if [[ -n "$GH_TOKEN" ]]; then
|
||||
REPO=${REPO/https:\/\//https://${GH_TOKEN}@}
|
||||
fi
|
||||
|
||||
git push $REPO
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
require 'open-uri'
|
||||
|
||||
require "octokit"
|
||||
client = Octokit::Client.new(:access_token => ENV["GITHUB_TOKEN"])
|
||||
client = Octokit::Client.new(:access_token => ENV["GH_TOKEN"])
|
||||
|
||||
require "jekyll"
|
||||
config = Jekyll.configuration("source" => File.expand_path('../', File.dirname(__FILE__)))
|
||||
|
||||
Reference in New Issue
Block a user