Add CI for downloading emojis

This commit is contained in:
CRIMX 2018-10-04 19:29:18 +08:00
parent 66b2369476
commit f31dc7d092
3 changed files with 28 additions and 1 deletions

7
.travis.yml Normal file
View file

@ -0,0 +1,7 @@
language: node_js
node_js:
- "8"
script:
- node update-emojis.js
after_success:
- bash push.sh

19
push.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
setup_git() {
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis CI"
}
commit_git() {
git add --all
git commit -am "[ci skip] Travis build: $TRAVIS_BUILD_NUMBER"
}
push_git() {
git push https://${GH_TOKEN}@github.com/crimx/hexo-filter-github-emojis.git HEAD:master
}
setup_git
commit_git
push_git

View file

@ -16,7 +16,7 @@ request({
if (error || !_.isObject(json)) {
console.error('Failded to download Github emojis.')
console.log(error, response, json)
return
process.exit(1)
}
const latestEmojis = Object.keys(json).reduce((emojis, name) => {
@ -39,6 +39,7 @@ request({
function (err) {
if (err) {
console.warn(err)
process.exit(1)
} else {
console.log(`Update ${Object.keys(emojis).length} emojis`)
}