Skip to content

Commit

Permalink
Merge pull request #20 from hikimochi/feature/automate_gem_release
Browse files Browse the repository at this point in the history
Feature/automate gem release
  • Loading branch information
nk-ty authored May 14, 2019
2 parents 457e4e7 + ab4ec10 commit b213baf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
25 changes: 23 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,20 @@ jobs:
- run: bundle exec rubocop -f html --out report.html
- store_artifacts:
path: report.html

publish:
docker:
- image: circleci/ruby:2.4.1
steps:
- add_ssh_keys:
finerprints:
- "6a:f3:d3:b5:a5:da:ce:e0:9f:22:f8:4a:2f:51:67:2b"
- checkout
- run:
name: Setup Rubygems
command: bash .circleci/setup_rubygems.sh
- run:
name: Update vresion.rb and publish on RubyGems
command: bash .circleci/deploy_to_rubygems.sh
workflows:
version: 2
test:
Expand All @@ -63,4 +76,12 @@ workflows:
- system_test
lint:
jobs:
- syntax_check
- syntax_check
deploy:
jobs:
- publish:
filters:
tags:
only: /^v[0-9]{1,}(\.[0-9]{1,}){2}$/
branches:
ignore: /.*/
14 changes: 14 additions & 0 deletions .circleci/deploy_to_rubygems.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
VERSION=$(git describe --tags | sed -e 's/^v//')
git config user.email "[email protected]"
git config user.name "bucky-operator"
# Update version.rb
sed -i -e "s/VERSION = \"[0-9]\{1,\}.[0-9]\{1,\}.[0-9]\{1,\}\"/VERSION = \"$VERSION\"/" lib/bucky/version.rb
git diff
git checkout master
git add lib/bucky/version.rb
git commit -m "Version $VERSION"
# Build and release gem
gem build bucky-core.gemspec
gem push "bucky-core-$VERSION.gem"
# Push to master
git push origin master
3 changes: 3 additions & 0 deletions .circleci/setup_rubygems.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mkdir ~/.gem
echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
chmod 0600 /home/circleci/.gem/credentials

0 comments on commit b213baf

Please sign in to comment.