Skip to content

Instantly share code, notes, and snippets.

@masutaka
Last active June 4, 2017 19:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masutaka/d9bf91e22567753fe76b to your computer and use it in GitHub Desktop.
Save masutaka/d9bf91e22567753fe76b to your computer and use it in GitHub Desktop.
circle.yml of masutaka.net
machine:
timezone:
Asia/Tokyo
test:
override:
- |
if [ -z "${BUNDLE_UPDATE}" ] ; then
cd chalow
./chalow -o ../webroot/chalow -c cl.conf clmemo.txt
fi
post:
- |
if [ -n "${BUNDLE_UPDATE}" -a "${CIRCLE_BRANCH}" = 'master' ] ; then
bundle update
fi
deployment:
production:
branch: master
commands:
- |
if [ -z "${BUNDLE_UPDATE}" ] ; then
./script/deploy-circleci.sh
else
./script/create_pull_request_if_needed.sh
fi
require 'octokit'
title = "bundle update #{Time.now.strftime('%Y-%m-%d')}"
body = 'auto generated by [CircleCI of masutaka.net](https://circleci.com/gh/masutaka/masutaka.net)'
client = Octokit::Client.new(access_token: ENV['GITHUB_ACCESS_TOKEN'])
client.create_pull_request(
'masutaka/masutaka.net',
'master',
ENV['BRANCH'],
title,
body
)
#!/bin/sh -ex
if [ -z $(git status -sb 2> /dev/null | grep Gemfile.lock) ]; then
exit 0
fi
export BRANCH=bundle-update-$(date -u "+%Y%m%d")
git config --global user.email circleci@example.com
git config --global user.name 'CircleCI'
git add Gemfile.lock
git commit -m '$ bundle update'
git branch -M $BRANCH
git push origin $BRANCH
bundle exec ruby script/create_pull_request.rb
#!/bin/sh -ex
cat <<EOF >> $HOME/.ssh/config
Host masutaka.net
User masutaka
ForwardAgent yes
EOF
ssh-add $HOME/.ssh/id_circleci_github
yes | bundle exec cap prod deploy
source 'https://rubygems.org'
ruby '2.2.0'
gem 'capistrano'
gem 'octokit'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment