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 1
1
version : 2.0
2
+ init : &init
3
+ run :
4
+ name : init
5
+ command : |
6
+ echo '. .circleci/shared.bash' >> "$BASH_ENV"
7
+
2
8
jobs :
3
9
test :
4
10
environment :
19
25
- coverage
20
26
- run : ./cc-test-reporter after-build --exit-code $? || echo "Send coverage skipped..."
21
27
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
+
22
46
workflows :
23
47
version : 2
24
48
test :
25
49
jobs :
26
50
- 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"
5
5
6
6
Gem ::Specification . new do |spec |
7
7
spec . name = "codeclimate-services"
8
- spec . version = CC ::Services :: VERSION
8
+ spec . version = CC ::Services . version
9
9
spec . authors = [ "Bryan Helmkamp" ]
10
10
spec . email = [ "bryan@brynary.com" ]
11
11
spec . summary = "Service classes for Code Climate"
Original file line number Diff line number Diff line change 1
1
module CC
2
2
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
4
8
end
5
9
end
You can’t perform that action at this time.
0 commit comments