Last active
June 4, 2017 19:25
-
-
Save masutaka/d9bf91e22567753fe76b to your computer and use it in GitHub Desktop.
circle.yml of masutaka.net
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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