This repository was archived by the owner on Jul 19, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +73
-2
lines changed Expand file tree Collapse file tree 5 files changed +73
-2
lines changed Original file line number Diff line number Diff line change 11version : 2.0
2+ init : &init
3+ run :
4+ name : init
5+ command : |
6+ echo '. .circleci/shared.bash' >> "$BASH_ENV"
7+
28jobs :
39 test :
410 environment :
1925 - coverage
2026 - run : ./cc-test-reporter after-build --exit-code $? || echo "Send coverage skipped..."
2127
28+ publish :
29+ machine : true
30+ steps :
31+ - checkout
32+ - *init
33+ - run :
34+ name : Install Hub dependency
35+ command : install_hub
36+ - run :
37+ name : Login on RubyGems
38+ command : login_to_rubygems
39+ - run :
40+ name : Publish new version
41+ command : |
42+ if [ `git diff --quiet HEAD~ VERSION; echo $?` -eq 1 ]; then
43+ publish_new_version
44+ fi
45+
2246workflows :
2347 version : 2
2448 test :
2549 jobs :
2650 - test
51+ - publish :
52+ requires :
53+ - test
54+ filters :
55+ branches :
56+ only :
57+ - master
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -exuo pipefail
4+
5+ VERSION=$( cat VERSION)
6+
7+ function install_hub() {
8+ sudo apt update && sudo apt install -y git wget
9+ url=" $( wget -qO- https://api.github.com/repos/github/hub/releases/latest | tr ' "' ' \n' | grep ' .*/download/.*/hub-linux-amd64-.*.tgz' ) "
10+ wget -qO- " $url " | sudo tar -xzvf- -C /usr/bin --strip-components=2 --wildcards " */bin/hub"
11+ }
12+
13+ function login_to_rubygems() {
14+ mkdir -p " $HOME /.gem"
15+ touch " $HOME /.gem/credentials"
16+ chmod 0600 " $HOME /.gem/credentials"
17+ printf -- " ---\n:rubygems_api_key: %s\n" " $GEM_HOST_API_KEY " > " $HOME /.gem/credentials"
18+ }
19+
20+ function tag_version() {
21+ GITHUB_TOKEN=" ${GITHUB_TOKEN} " hub release create -m " v${VERSION} " " v${VERSION} "
22+ }
23+
24+
25+ function publish_new_version() {
26+ set +x
27+ # Build and push gem
28+ gem build ./* .gemspec
29+ gem push ./* .gem
30+
31+ # Create gh tag
32+ tag_version
33+
34+ set -x
35+ }
Original file line number Diff line number Diff line change 1+ 1.11.4
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ require "cc/services/version"
55
66Gem ::Specification . new do |spec |
77 spec . name = "codeclimate-services"
8- spec . version = CC ::Services :: VERSION
8+ spec . version = CC ::Services . version
99 spec . authors = [ "Bryan Helmkamp" ]
1010 spec . email = [ "bryan@brynary.com" ]
1111 spec . summary = "Service classes for Code Climate"
Original file line number Diff line number Diff line change 11module CC
22 module Services
3- VERSION = "1.11.3" . freeze
3+ def version
4+ path = File . expand_path ( "../../../../VERSION" , __FILE__ )
5+ @version ||= File . read ( path ) . strip
6+ end
7+ module_function :version
48 end
59end
You can’t perform that action at this time.
0 commit comments