Skip to content

Instantly share code, notes, and snippets.

@callmekohei
Last active July 11, 2017 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save callmekohei/ee34b398fe3d7c5a9fd35508756f2e12 to your computer and use it in GitHub Desktop.
Save callmekohei/ee34b398fe3d7c5a9fd35508756f2e12 to your computer and use it in GitHub Desktop.

Travis to Github

chart

    folder A
    ->  repository A
    ->  Travis
    ->  repository B

prepare

gem install travis

login

go to folder A

$ travis login

create ssh pair keys

$ ssh-keygen -f deploy_key

add public key to Github repository

$ cat deploy_key.pub

Github repository B : Setting -> Deploy keys

encrypt key

$ travis encrypt-file deploy_key

openssl aes-256-cbc -K $encrypted_b811b6a1fc44_key -iv $encrypted_b811b6a1fc44_iv -in deploy_key.enc -out deploy_key -d

.gitignore

!.travis.yml
!deploy_key.enc
deploy_key
deploy_key.pub

.travis.yaml ( sample )

after_success:
  # prepare
  - openssl aes-256-cbc -K $encrypted_b811b6a1fc44_key -iv $encrypted_b811b6a1fc44_iv -in deploy_key.enc -out ~/.ssh/id_rsa -d
  - chmod 600 ~/.ssh/id_rsa
  - echo -e "Host github.com"                >> ~/.ssh/config
  - echo -e "\n\tUser git"                   >> ~/.ssh/config
  - echo -e "\n\tStrictHostKeyChecking no"   >> ~/.ssh/config
  - echo -e "\n\tIdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
  - echo -e "\n\tIdentitiesOnly yes"         >> ~/.ssh/config
  - echo -e "\n\tForwardAgent yes"           >> ~/.ssh/config
  - git config --global user.email "callmekohei@gmail.com"
  - git config --global user.name "callmekohei"
  # git operations
  - cd ..
  - git clone git@github.com:callmekohei/deoplete-fsharp-bin.git
  - rm -rf ./deoplete-fsharp-bin/bin_deopletefs
  - cp -rf ./deopletefs/bin_deopletefs ./deoplete-fsharp-bin/
  - cd ./deoplete-fsharp-bin
  - git add --all
  - git commit -m "by Travis CI (JOB $TRAVIS_JOB_NUMBER)"
  - git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment