renuo-cli 3.1.1 → 3.1.4

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: a3ebfe107422fcb325aaeaeb8ee0bb8a7d7180c2ff9bce010c623bc680c8606c
4
+ data.tar.gz: b015920000dd363cc2957677694fff8efe041a6068f38594fb545281a2e1ae14
5
5
  SHA512:
6
- metadata.gz: 920b11fcc5d8135ac1e443916a7453f3317bf9b834438eb7d2c4c0031917250ad525b657cb6cb45b01ca92e4bb287186e34ad44fc7275d47947de590db2b3aeb
7
- data.tar.gz: b555c4b20295c9094a43635868ff090f0ca63f50804985a0e2744892d0e51d7e9a2973e6a8e7a5ea735569c6b93f7585537c9c9bfda10d215a58d98a115ae3e0
6
+ metadata.gz: b697804eceb13dfe6a27e3135c3f8a9c18405f7af3b98cd02e5f7ec029a37134e1f7b0a781697e8970a00cf9d93599c4c6d29080ff09c4e9b9fb8bbf876b1121
7
+ data.tar.gz: 5fd0187df881a7dbfb3dfbd2b6d4e56473905f9ad3f7c56c775b1b765ac1b749446b991e0de97e1a4f6367e04187767d4e2a82990b989b5f9222d7f5d191b98d
@@ -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
data/README.md CHANGED
@@ -32,11 +32,11 @@ To release a new version, update the version number in `version.rb`, and then ru
32
32
 
33
33
  ## Release
34
34
 
35
- * Bump the version number in `lib/renuo/cli/version.rb` and commit to `master`
35
+ * Bump the version number in `lib/renuo/cli/version.rb` and commit to `main`
36
36
 
37
37
  ### Automatic
38
38
 
39
- * Deploy through Semaphore console by starting a promotion to master
39
+ * Deploy through Semaphore console by starting a promotion to main
40
40
 
41
41
  ### Manual
42
42
 
@@ -1,9 +1,9 @@
1
1
  class CreateHerokuApp
2
- ADMIN_EMAIL = 'admin@renuo.ch'.freeze
2
+ ADMIN_EMAIL = 'operations@renuo.ch'.freeze
3
3
 
4
4
  def initialize; end
5
5
 
6
- def run(*args)
6
+ def run(args)
7
7
  project_name = args[0]
8
8
  abort('>> Project name must be between 2 and 22 characters.') unless project_name&.length&.between?(2, 22)
9
9
  emails = FetchEmails.new.fetch_emails
@@ -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} --no-edit",
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 = "https://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.4'.freeze
4
4
  NAME = 'renuo-cli'.freeze
5
5
  end
6
6
  end
data/lib/renuo/cli.rb CHANGED
@@ -111,7 +111,7 @@ module Renuo
111
111
  command 'create-aws-project' do |c|
112
112
  c.syntax = 'renuo create-aws-project'
113
113
  c.summary = 'Generates necessary commands for our project setup on AWS incl. necessary installations.'
114
- c.description = <<-DESCRIPTION
114
+ c.description = <<~DESCRIPTION
115
115
  This creates commands for creating AWS users, buckets an versioning policies and CloudFront.
116
116
  It also guides you to set up the necessary environment.
117
117
 
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.4
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-05-16 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