Skip to content

Commit eadf464

Browse files
authored
Integrate with circle ci (#4)
* circleci integration * try rubygems * fix path * fix path rightly this time * gem_credentials * update version * fail if tag already exists * take correct version * only push if master * Update README.md
1 parent de49d7f commit eadf464

File tree

5 files changed

+78
-2
lines changed

5 files changed

+78
-2
lines changed

.circleci/config.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
version: 2.1
2+
3+
jobs:
4+
build:
5+
docker:
6+
- image: circleci/ruby:2.7.1-node
7+
environment:
8+
- RAILS_ENV=test
9+
- RACK_ENV=test
10+
steps:
11+
- checkout
12+
- restore_cache:
13+
keys:
14+
- bundle-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
15+
- run:
16+
name: Install gems
17+
command: bundle install --path ~/.cache/bundle
18+
- save_cache:
19+
key: bundle-{{.Branch}}-{{ checksum "Gemfile.lock" }}
20+
paths:
21+
- ~/.cache/bundle
22+
- run:
23+
name: Run tests
24+
command: bundle exec rspec
25+
- run:
26+
name: Check code style
27+
command: bundle exec rubocop
28+
deploy:
29+
docker:
30+
- image: circleci/ruby:2.7.1-node
31+
steps:
32+
- checkout
33+
- run:
34+
name: Tag the version
35+
command: |
36+
git fetch --tags
37+
version=$(cat lib/cirro_io/client/version.rb | grep VERSION | awk -F' = ' '{print $2}' | xargs)
38+
if git rev-parse v"$version" >/dev/null 2>&1; then
39+
echo "This version already exists. Please update the version";
40+
exit 1
41+
else
42+
git tag v"$version"
43+
git push origin v"$version"
44+
fi
45+
- run:
46+
name: build gem
47+
command: gem build cirro-ruby-client.gemspec
48+
- run:
49+
name: push to rubygems
50+
command: |
51+
version=$(cat lib/cirro_io/client/version.rb | grep VERSION | awk -F' = ' '{print $2}' | xargs)
52+
echo "gem `gem --version`"
53+
mkdir ~/.gem
54+
cat .circleci/gem_credentials | sed -e "s/__RUBYGEMS_API_KEY__/${RUBYGEMS_API_KEY}/" > ~/.gem/credentials
55+
chmod 0600 ~/.gem/credentials
56+
gem push cirro-ruby-client-$version.gem
57+
shred -u ~/.gem/credentials
58+
59+
workflows:
60+
version: 2
61+
deploy_the_gem:
62+
jobs:
63+
- build
64+
- deploy:
65+
requires:
66+
- build
67+
filters:
68+
branches:
69+
only:
70+
- master

.circleci/gem_credentials

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
:rubygems_api_key: __RUBYGEMS_API_KEY__

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
cirro-ruby-client (0.1.0)
4+
cirro-ruby-client (0.1.2)
55
json_api_client
66
jwt
77

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This gem provides access to the [Cirro REST API](https://staging.cirro.io/api-docs/v1#cirro-api-documentation).
44

5+
[![CircleCI](https://circleci.com/gh/test-IO/cirro-ruby-client/tree/master.svg?style=svg)](https://circleci.com/gh/test-IO/cirro-ruby-client/tree/master)
6+
57
## Installation
68

79
Add this line to your application's Gemfile:

lib/cirro_io/client/version.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# rubocop:disable Style/MutableConstant
12
module CirroIO
23
module Client
3-
VERSION = '0.1.0'.freeze
4+
VERSION = '0.1.3'
45
end
56
end
7+
# rubocop:enable Style/MutableConstant

0 commit comments

Comments
 (0)