Closed abhiesa closed 10 years ago
Q2 & Q3)
http://docs.travis-ci.com/user/encryption-keys/
about DEPLOY_REPO:
travis encrypt DEPLOY_REPO=https://6b75cfe9836f56e6d21187622730889874476c23@github.com/jkeylu/test-hexo-on-travis-ci.git
generate github token: https://github.com/settings/applications#personal-access-tokens
Q1)
git clone --depth 1 --branch gh-pages --single-branch $DEPLOY_REPO . || (git init && git remote add -t gh-pages origin $DEPLOY_REPO)
clone your remote repo to local, if failed (it mean that remote repo does not exists gh-pages branch) init local repo
You also can look at here https://github.com/jkeylu/deploy-hexo-site-by-travis-ci
You are awesome,
I didn't do encryption key, but defined a variable in travis-ci.
Please have a look on [https://github.com/abhiesa/abhiesa.github.io] and let me know, of any improvement. I am not using gh-pages, but the code is for my blog hosted on [http://abhiesa.github.com]
I did something like this.
language: node_js
node_js:
- "0.10"
branches:
only:
- source
before_install:
- npm install -g hexo
install:
- npm install
before_script:
- git config --global user.name 'Abhishek Prashant Pandey'
- git config --global user.email 'abhiesa@gmail.com'
script:
- hexo generate
after_success:
- mkdir .deploy
- cd .deploy
- git clone --depth 1 --branch master --single-branch $DEPLOY_REPO . || (git init && git remote add -t master origin $DEPLOY_REPO)
- rm -rf ./*
- cp -r ../public/* .
- git add -A .
- git commit -m 'Auto Update from TRAVIS-CI'
- git branch -m master
- git push -q $DEPLOY_REPO HEAD:master
Thanks for sharing the script. But there are couple of things which i want to understand. My objective is simple.
Q1) What above line means? Q2) What should be value of variable of DEPLOY_REPO evariable?
Q3) How above line is going to impact my build, and what is it?