mirror of
https://github.com/zhigang1992/probot.github.io.git
synced 2026-04-28 20:25:25 +08:00
Use Travis CI cron to sync changes
This commit is contained in:
14
.travis.yml
14
.travis.yml
@@ -1,17 +1,15 @@
|
|||||||
before_script: "./script/bootstrap"
|
before_script: "./script/bootstrap"
|
||||||
script: "./script/test"
|
script: "./script/cibuild"
|
||||||
|
|
||||||
#environment
|
|
||||||
language: ruby
|
language: ruby
|
||||||
rvm:
|
rvm:
|
||||||
- 2.4.0
|
- 2.4.0
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email: false
|
email: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
||||||
|
- GIT_AUTHOR_NAME="Probot"
|
||||||
|
- GIT_AUTHOR_EMAIL="bkeepers+probot@github.com"
|
||||||
|
- secure: gGUZ+Mtu0LgGhxh9Gd/0gOvoCvoFipi/c6N/4lw5vQtCj7bweQw9/4D6ywpdAc2EDqp9oQ67qBuqLWk5kIhtD3eR7F8thzfF/EeqwizHN6ILqFivDb5a2vFa4b00IOAQFICH9whPT9l673lQ9aysnLlQXi2SwQdV4ysW9UkJaUtKPVSUGer46kN/YvtqyaV//kYksugqUz6pZzPxEtdAgvDIQ8R8p7G0cE/CRcAfHB1D/jS3AfIKzdgdbRxRlTPr0fIi8DQhDGr3o/sPLXotblG9btonVov2jcJpM6+2mZBaiR5V2h9WzjLa3ubk3qq26qKzURVjdFCx5USd/BB+clyadgMxgARKhODq65UYGPaiSZ8poheFz7PtfyvIx6L6miqG8B6uPiIy9553xnVT7Z+ZrqrE7hqUmyzPTfXQ6bAje3Aez2NTjRw0fri5O/pjyhrbkb/0trXguKrvFqeBRYxklM4ES6XHfNmo88APfB7FBs/k5TCgdKSC9FuJwY5IFLt0zWIvtAGTHn//1Zvjak+fXbo5nKzYinfb6c7Ba7v22o+VKawxJd6YUOMpLbCfD59puRtRlP/fnydNJqc553Oqvz/dMLfvMMCB95ZnfZ9rdhPMpNN0GWU7k3NeSorAOVKnAmLDRHAyfO3YOignvOKo0Ymnhq9OcGb+Of7jq4M=
|
||||||
sudo: false
|
sudo: false
|
||||||
cache: bundler
|
cache: bundler
|
||||||
|
|||||||
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
|
#!/usr/bin/env bash
|
||||||
|
# Run script/sync-data and push changes.
|
||||||
|
|
||||||
set -x # print commands before execution
|
set -x # print commands before execution
|
||||||
set -o errexit # always exit on error
|
set -o errexit # always exit on error
|
||||||
set -o pipefail # honor exit codes when piping
|
set -o pipefail # honor exit codes when piping
|
||||||
set -o nounset # fail on unset variables
|
|
||||||
|
|
||||||
# expected environment variables
|
echo "===> Syncing data"
|
||||||
# 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
|
|
||||||
script/sync-data
|
script/sync-data
|
||||||
|
|
||||||
git diff-index --quiet HEAD -- || {
|
git diff --quiet || {
|
||||||
git add .
|
echo "===> Committing and pushing changes"
|
||||||
git commit -am "Sync data"
|
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 'open-uri'
|
||||||
|
|
||||||
require "octokit"
|
require "octokit"
|
||||||
client = Octokit::Client.new(:access_token => ENV["GITHUB_TOKEN"])
|
client = Octokit::Client.new(:access_token => ENV["GH_TOKEN"])
|
||||||
|
|
||||||
require "jekyll"
|
require "jekyll"
|
||||||
config = Jekyll.configuration("source" => File.expand_path('../', File.dirname(__FILE__)))
|
config = Jekyll.configuration("source" => File.expand_path('../', File.dirname(__FILE__)))
|
||||||
|
|||||||
Reference in New Issue
Block a user