jkeylu / test-hexo-on-travis-ci

MIT License
0 stars 0 forks source link

Need Help #1

Closed abhiesa closed 10 years ago

abhiesa commented 10 years ago

Thanks for sharing the script. But there are couple of things which i want to understand. My objective is simple.

  1. I want to write the markdown content locally.
  2. create new file under _post folder and paste content into it, using github website
  3. travis will generate my bolg, automatically, with new content
  4. My source is in source branch, and want to change happen on master (abhiesa.github.com)
git clone --depth 1 --branch master --single-branch $DEPLOY_REPO . || (git init && git remote add -t master origin $DEPLOY_REPO)

Q1) What above line means? Q2) What should be value of variable of DEPLOY_REPO evariable?

env:
  global:
    secure: j8xMFmBDjUvqmKwLCWhXG1wKi4DsGGtN6vJ4aBxCp3ka5iusxHKBBHsi465ppbKYZF4eGugoXFT7dknCZyEcdIxxqNhFxY4qjm9K6KWXakVsqMz3YngbqDPFS5UJZr3DUxTlE0RPxkBgty+N1qiAkf2LTm1x4UygKIM7AKINbQE=

Q3) How above line is going to impact my build, and what is it?

jkeylu commented 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

abhiesa commented 10 years ago

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