renuo-cli 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c63f2b385a0924947d1b2a9379a836576b8d28c22a56aab71a8b8c5b7e912a59
4
- data.tar.gz: 9f518b1bf101f4a65b93db3a595f5afbc2e1d94389a454511e5c6a4db1bc69d0
3
+ metadata.gz: b15431d56265376a769e662fd9b467c0c1b0753a5b27e4429821ec37e87f9e01
4
+ data.tar.gz: 29a10806d01da5cbb8b2a2946fdeb5226fd3cdafc36c4bec15cf0cc20a6f88ec
5
5
  SHA512:
6
- metadata.gz: 920b11fcc5d8135ac1e443916a7453f3317bf9b834438eb7d2c4c0031917250ad525b657cb6cb45b01ca92e4bb287186e34ad44fc7275d47947de590db2b3aeb
7
- data.tar.gz: b555c4b20295c9094a43635868ff090f0ca63f50804985a0e2744892d0e51d7e9a2973e6a8e7a5ea735569c6b93f7585537c9c9bfda10d215a58d98a115ae3e0
6
+ metadata.gz: 69a90927c91e4b854c7cf2d9ed57ac4d3a27573c446c9232d951815e36e66cdc46cbdeecf299579837cedaa1536ab9190610645e747626628d713cb61af0fc23
7
+ data.tar.gz: ce3f379d8e365792f82024d3aa12a1d13ed697ffd85b50ff41bc10f112ee230a3c2c78991fb9b484faaf716906624f2786114b035c63d0f3cb9ca9598c887382
@@ -1,17 +1,17 @@
1
1
  version: v1.0
2
- name: master-deploy
2
+ name: main-deploy
3
3
  agent:
4
4
  machine:
5
5
  type: e1-standard-2
6
6
  os_image: ubuntu1804
7
7
 
8
8
  blocks:
9
- - name: master-deploy
9
+ - name: main-deploy
10
10
  task:
11
11
  secrets:
12
12
  - name: rubygems-deploy
13
13
  jobs:
14
- - name: master-deploy
14
+ - name: main-deploy
15
15
  commands:
16
16
  - checkout --use-cache
17
17
  - gem build renuo-cli
@@ -9,7 +9,7 @@ auto_cancel:
9
9
  when: "true"
10
10
  fail_fast:
11
11
  cancel:
12
- when: "branch != 'master'"
12
+ when: "branch != 'main'"
13
13
 
14
14
  blocks:
15
15
  - name: tests
@@ -30,5 +30,5 @@ blocks:
30
30
  commands:
31
31
  - bin/check
32
32
  promotions:
33
- - name: master
34
- pipeline_file: master-deploy.yml
33
+ - name: main
34
+ pipeline_file: main-deploy.yml
@@ -71,7 +71,7 @@ class ReleaseProject
71
71
  abort('>> Project not found on Github.') unless system("#{MOVE_TO_TMP_FOLDER} && gh repo clone #{@project_name}")
72
72
 
73
73
  system(cmd_in_folder("git checkout #{main_branch} && git pull origin #{main_branch} &&" \
74
- 'git checkout develop && git pull origin develop && git flow init -d'))
74
+ "git checkout #{develop_branch} && git pull origin #{develop_branch}"))
75
75
  end
76
76
 
77
77
  def calculate_version
@@ -80,7 +80,6 @@ class ReleaseProject
80
80
 
81
81
  def release
82
82
  ask_for_final_confirmation
83
- start_release_branch
84
83
  bump_version
85
84
  if finish_release_branch
86
85
  puts ">> Project successfully released with version #{@version}."
@@ -90,14 +89,12 @@ class ReleaseProject
90
89
  end
91
90
 
92
91
  def current_version
93
- return @current_version if @current_version
94
-
95
- @current_version = if `#{cmd_in_folder('git tag')}` == ''
96
- '0.0.0'
97
- else
98
- sorted_tags = `#{cmd_in_folder('git tag --sort=taggerdate')}`.split("\n").reverse
99
- sorted_tags.find { |tag| tag =~ RenuoVersion::SEMVER_SCHEMA }.strip
100
- end
92
+ @current_version ||= if `#{cmd_in_folder('git tag')}` == ''
93
+ '0.0.0'
94
+ else
95
+ sorted_tags = `#{cmd_in_folder('git tag --sort=taggerdate')}`.split("\n").reverse
96
+ sorted_tags.find { |tag| tag =~ RenuoVersion::SEMVER_SCHEMA }.strip
97
+ end
101
98
  end
102
99
 
103
100
  def bump_version
@@ -105,7 +102,7 @@ class ReleaseProject
105
102
 
106
103
  return unless version_bumped
107
104
 
108
- system(cmd_in_folder("git add . && git commit -m \"bump version\" && git push -u origin release/#{@version}"))
105
+ system(cmd_in_folder('git add . && git commit -m "bump version"'))
109
106
  end
110
107
 
111
108
  def find_and_replace_version
@@ -135,26 +132,43 @@ class ReleaseProject
135
132
  system(cmd_in_folder("sed -i '' 's|#{current_version}|#{@version}|g' #{file_name}"))
136
133
  end
137
134
 
138
- def start_release_branch
139
- system(cmd_in_folder("git flow release start #{@version}"))
135
+ def finish_release_branch
136
+ merge_branches
137
+ push_branches_and_tags
140
138
  end
141
139
 
142
- def finish_release_branch
143
- system(cmd_in_folder("GIT_MERGE_AUTOEDIT=no git flow release finish -m #{@version} #{@version} && " \
144
- 'git checkout develop && git push origin develop && ' \
145
- "git checkout #{main_branch} && git push origin #{main_branch} --tags"))
140
+ def merge_branches
141
+ system(
142
+ cmd_in_folder(
143
+ [
144
+ "GIT_MERGE_AUTOEDIT=no git checkout #{main_branch}",
145
+ "git merge #{develop_branch}",
146
+ "git tag -a #{@version} -m \"Release with versioin: #{@version}\""
147
+ ].join(' && ')
148
+ )
149
+ )
150
+ end
151
+
152
+ def push_branches_and_tags
153
+ push_branch(develop_branch)
154
+ push_branch(main_branch)
155
+ system(cmd_in_folder("git checkout #{main_branch} && git push origin #{main_branch} --tags"))
156
+ end
157
+
158
+ def push_branch(branch)
159
+ system(cmd_in_folder("git checkout #{branch} && git push origin #{branch}"))
146
160
  end
147
161
 
148
162
  def ask_for_final_confirmation
149
163
  unless agree(">> Are you sure you wish to deploy '#{@project_name}' " \
150
- "as a #{@update_type} release (#{current_version} => #{@version})?")
164
+ "as a #{@update_type} release (#{current_version} => #{@version})?")
151
165
  abort('>> Cancelling Release.')
152
166
  end
153
167
 
154
168
  return unless Time.now.friday? && Time.now.hour >= 16
155
169
 
156
170
  unless agree('>> Are you sure you want to deploy on late Friday afternoon? ' \
157
- 'Did you think about your family...waiting for you at home?')
171
+ 'Did you think about your family...waiting for you at home?')
158
172
  abort('>> Very good. Go home now.')
159
173
  end
160
174
  end
@@ -176,6 +190,11 @@ class ReleaseProject
176
190
  end
177
191
 
178
192
  def main_branch
179
- @main_branch ||= system(cmd_in_folder('git checkout main && git show-ref refs/heads/main')) ? 'main' : 'master'
193
+ remote_repo = "git@github.com:#{@project_name}.git"
194
+ @main_branch ||= `git ls-remote --heads #{remote_repo} main`.empty? ? 'master' : 'main'
195
+ end
196
+
197
+ def develop_branch
198
+ 'develop'
180
199
  end
181
200
  end
@@ -23,5 +23,4 @@ blocks:
23
23
  - git config --global url.ssh://git@heroku.com/.insteadOf https://git.heroku.com/
24
24
  - git remote add heroku $HEROKU_REMOTE
25
25
  - git push heroku -f $SEMAPHORE_GIT_BRANCH:main
26
- - heroku run -x rails db:migrate
27
- - heroku dyno:restart
26
+ - if heroku run -x rails db:migrate; then heroku dyno:restart; else heroku rollback; exit -1; fi
@@ -92,6 +92,15 @@ blocks:
92
92
  - name: tests
93
93
  commands:
94
94
  - bin/check
95
+ epilogue:
96
+ on_fail:
97
+ commands:
98
+ - mkdir -p log
99
+ - mkdir -p tmp/screenshots
100
+ - mkdir -p coverage
101
+ - artifact push job log --expire-in 2w
102
+ - artifact push job tmp/screenshots --expire-in 2w
103
+ - artifact push job coverage --expire-in 2w
95
104
  promotions:
96
105
  - name: develop
97
106
  pipeline_file: develop-deploy.yml
@@ -1,6 +1,6 @@
1
1
  module Renuo
2
2
  module Cli
3
- VERSION = '3.1.1'.freeze
3
+ VERSION = '3.1.2'.freeze
4
4
  NAME = 'renuo-cli'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: renuo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renuo AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-10 00:00:00.000000000 Z
11
+ date: 2022-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -307,7 +307,7 @@ files:
307
307
  - ".ruby-version"
308
308
  - ".semaphore/bin/cache_restore"
309
309
  - ".semaphore/bin/cache_store"
310
- - ".semaphore/master-deploy.yml"
310
+ - ".semaphore/main-deploy.yml"
311
311
  - ".semaphore/semaphore.yml"
312
312
  - Gemfile
313
313
  - LICENSE.txt