opera 0.2.0 → 0.2.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: b922627852454757caa71f7e68809b9917497f85f2d030b2b34d2482ed47a2df
4
- data.tar.gz: 8fad54614ba1f135b2a2b3f5aac75d2c52552fd3ba2dd8f9b378476efe52fc6a
3
+ metadata.gz: b63b9dffc54255a4cc0e1e1c7f243258d36eb6e2812702a259073d705b1d680e
4
+ data.tar.gz: 3dba8a4459b1215f61af896ee712de74cf870103e70681ba30301904632e6225
5
5
  SHA512:
6
- metadata.gz: ea6e336bd01af71651d07a2d7987ae5549a95868f6d003a94bb193bc028126a7df86158c36da9050bb7aed000b1265f536bde3156b41abb670d08132bb9269e2
7
- data.tar.gz: b1a3ed4f3c40f05def6b75caaf1d98d64629d9f423a4c0bf8137ac1fa18972c55269501cefec9f52d147bcf79c344979c778c257ecd1420ce2612a886ca077e3
6
+ metadata.gz: ef95fe48da334013d5c873e8b7a1f24dad951ce81b40b0d389c7b348d4a7f376b4bf1ff0b5e1fa861f22dd9fb22a74ad670a7b0ab536b671f85d889c55187651
7
+ data.tar.gz: 6539b51d037350cab91486f43f837fb194b9dcf298e36266cde0759552ed277866538959307d5a107284fdbc983d36b4695f539957748a2947c490534cec7ba9
@@ -0,0 +1,66 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ ruby-version: [ '2.6', '2.7', '3.0' ]
13
+
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+ - name: Set up Ruby
17
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
18
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
19
+ # uses: ruby/setup-ruby@v1
20
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
21
+ with:
22
+ ruby-version: ${{ matrix.ruby-version }}
23
+ bundler-cache: false # runs 'bundle install' and caches installed gems automatically
24
+ - name: Install gems
25
+ run: bundle install
26
+ - name: Run tests
27
+ run: bundle exec rspec
28
+
29
+ tag:
30
+ needs: test
31
+ runs-on: ubuntu-latest
32
+
33
+ steps:
34
+ - uses: actions/checkout@v2
35
+
36
+ - name: Tag automatically
37
+ run: git tag v`cat lib/opera/version.rb | grep 'VERSION' | awk '{ print $3 $4 }' | sed "s/'//g"`
38
+
39
+ - name: Push tags
40
+ run: git push origin --tags
41
+
42
+ publish:
43
+ needs: tag
44
+ name: Build + Publish
45
+ runs-on: ubuntu-latest
46
+ permissions:
47
+ contents: read
48
+ packages: write
49
+
50
+ steps:
51
+ - uses: actions/checkout@v2
52
+ - name: Set up Ruby 2.6
53
+ uses: actions/setup-ruby@v1
54
+ with:
55
+ ruby-version: 2.6.x
56
+
57
+ - name: Publish to RubyGems
58
+ run: |
59
+ mkdir -p $HOME/.gem
60
+ touch $HOME/.gem/credentials
61
+ chmod 0600 $HOME/.gem/credentials
62
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
63
+ gem build *.gemspec
64
+ gem push *.gem
65
+ env:
66
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -5,17 +5,14 @@
5
5
  # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
6
  # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
7
 
8
- name: Ruby
8
+ name: Specs
9
9
 
10
10
  on:
11
- push:
12
- branches: [ master ]
13
11
  pull_request:
14
12
  branches: []
15
13
 
16
14
  jobs:
17
15
  test:
18
-
19
16
  runs-on: ubuntu-latest
20
17
  strategy:
21
18
  matrix:
data/CHANGELOG.md CHANGED
@@ -1,6 +1,23 @@
1
1
  # Opera Changelog
2
2
 
3
+ ### 0.2.4 - July 26, 2021
4
+
5
+ - prevent default from overwrite falsy values
6
+ - allow params and dependencies to get defaults
7
+
8
+ ### 0.2.3 - July 26, 2021
9
+
10
+ - Support context, params and dependencies accessors
11
+ - Removed depreceted `finish` method. Please use `finish!` from today
12
+
13
+ ## 0.2.2 - July 7, 2021
14
+
15
+ - Test release using Github Actions
16
+
17
+ ## 0.2.1 - July 7, 2021
18
+
19
+ - Support for transaction options
20
+
3
21
  ## 0.1.0 - September 12, 2020
4
22
 
5
23
  - Initial release
6
-
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM ruby:2.7.1
1
+ FROM ruby:3
2
2
 
3
3
  MAINTAINER ProFinda Developers <dev@profinda.com>
4
4
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opera (0.1.2)
4
+ opera (0.2.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -81,4 +81,4 @@ DEPENDENCIES
81
81
  rspec (~> 3.0)
82
82
 
83
83
  BUNDLED WITH
84
- 2.1.4
84
+ 2.2.15
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Opera
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/opera.svg)](https://badge.fury.io/rb/opera)
4
+ ![Master](https://github.com/Profinda/opera/actions/workflows/release.yml/badge.svg?branch=master)
5
+
6
+
3
7
  Simple DSL for services/interactions classes.
4
8
 
5
9
  Opera was born to mimic some of the philosophy of the dry gems but keeping the DSL simple.
@@ -31,6 +35,7 @@ Simply initialise the configuration and chose what method you want to use to rep
31
35
  Opera::Operation::Config.configure do |config|
32
36
  config.transaction_class = ActiveRecord::Base
33
37
  config.transaction_method = :transaction
38
+ config.transaction_options = { requires_new: true }
34
39
  config.reporter = defined?(Rollbar) ? Rollbar : Rails.logger
35
40
  end
36
41
  ```
@@ -151,6 +156,9 @@ Some cases and example how to use new operations
151
156
 
152
157
  ```ruby
153
158
  class Profile::Create < Opera::Operation::Base
159
+ context_accessor :profile
160
+ dependencies_reader :current_account, :mailer
161
+
154
162
  validate :profile_schema
155
163
 
156
164
  step :create
@@ -164,15 +172,15 @@ class Profile::Create < Opera::Operation::Base
164
172
  end
165
173
 
166
174
  def create
167
- context[:profile] = dependencies[:current_account].profiles.create(params)
175
+ self.profile = current_account.profiles.create(params)
168
176
  end
169
177
 
170
178
  def send_email
171
- dependencies[:mailer]&.send_mail(profile: context[:profile])
179
+ mailer&.send_mail(profile: profile)
172
180
  end
173
181
 
174
182
  def output
175
- result.output = { model: context[:profile] }
183
+ result.output = { model: profile }
176
184
  end
177
185
  end
178
186
  ```
@@ -221,6 +229,9 @@ Profile::Create.call(params: {
221
229
 
222
230
  ```ruby
223
231
  class Profile::Create < Opera::Operation::Base
232
+ context_accessor :profile
233
+ dependencies_reader :current_account, :mailer
234
+
224
235
  validate :profile_schema
225
236
 
226
237
  step :create
@@ -236,16 +247,17 @@ class Profile::Create < Opera::Operation::Base
236
247
  end
237
248
 
238
249
  def create
239
- context[:profile] = dependencies[:current_account].profiles.create(context[:profile_schema_output])
250
+ self.profile = current_account.profiles.create(context[:profile_schema_output])
240
251
  end
241
252
 
242
253
  def send_email
243
- return true unless dependencies[:mailer]
244
- dependencies[:mailer].send_mail(profile: context[:profile])
254
+ return true unless mailer
255
+
256
+ mailer.send_mail(profile: profile)
245
257
  end
246
258
 
247
259
  def output
248
- result.output = { model: context[:profile] }
260
+ result.output = { model: profile }
249
261
  end
250
262
  end
251
263
  ```
@@ -267,6 +279,9 @@ Profile::Create.call(params: {
267
279
 
268
280
  ```ruby
269
281
  class Profile::Create < Opera::Operation::Base
282
+ context_accessor :profile
283
+ dependencies_reader :current_account, :mailer
284
+
270
285
  validate :profile_schema
271
286
 
272
287
  step :build_record
@@ -282,29 +297,29 @@ class Profile::Create < Opera::Operation::Base
282
297
  end
283
298
 
284
299
  def build_record
285
- context[:profile] = dependencies[:current_account].profiles.build(params)
286
- context[:profile].force_name_validation = true
300
+ self.profile = current_account.profiles.build(params)
301
+ self.profile.force_name_validation = true
287
302
  end
288
303
 
289
304
  def old_validation
290
- return true if context[:profile].valid?
305
+ return true if profile.valid?
291
306
 
292
307
  result.add_information(missing_validations: "Please check dry validations")
293
- result.add_errors(context[:profile].errors.messages)
308
+ result.add_errors(profile.errors.messages)
294
309
 
295
310
  false
296
311
  end
297
312
 
298
313
  def create
299
- context[:profile].save
314
+ profile.save
300
315
  end
301
316
 
302
317
  def send_email
303
- dependencies[:mailer].send_mail(profile: context[:profile])
318
+ mailer.send_mail(profile: profile)
304
319
  end
305
320
 
306
321
  def output
307
- result.output = { model: context[:profile] }
322
+ result.output = { model: profile }
308
323
  end
309
324
  end
310
325
  ```
@@ -340,6 +355,9 @@ Profile::Create.call(params: {
340
355
 
341
356
  ```ruby
342
357
  class Profile::Create < Opera::Operation::Base
358
+ context_accessor :profile
359
+ dependencies_reader :current_account, :mailer
360
+
343
361
  validate :profile_schema
344
362
 
345
363
  step :build_record
@@ -355,8 +373,8 @@ class Profile::Create < Opera::Operation::Base
355
373
  end
356
374
 
357
375
  def build_record
358
- context[:profile] = dependencies[:current_account].profiles.build(params)
359
- context[:profile].force_name_validation = true
376
+ self.profile = current_account.profiles.build(params)
377
+ self.profile.force_name_validation = true
360
378
  end
361
379
 
362
380
  def exception
@@ -364,21 +382,23 @@ class Profile::Create < Opera::Operation::Base
364
382
  end
365
383
 
366
384
  def create
367
- context[:profile] = context[:profile].save
385
+ self.profile = profile.save
368
386
  end
369
387
 
370
388
  def send_email
371
- return true unless dependencies[:mailer]
389
+ return true unless mailer
372
390
 
373
- dependencies[:mailer].send_mail(profile: context[:profile])
391
+ mailer.send_mail(profile: profile)
374
392
  end
375
393
 
376
394
  def output
377
- result.output(model: context[:profile])
395
+ result.output(model: profile)
378
396
  end
379
397
  end
380
398
  ```
399
+
381
400
  ##### Call with step throwing exception
401
+
382
402
  ```ruby
383
403
  result = Profile::Create.call(params: {
384
404
  first_name: :foo,
@@ -394,6 +414,9 @@ result = Profile::Create.call(params: {
394
414
 
395
415
  ```ruby
396
416
  class Profile::Create < Opera::Operation::Base
417
+ context_accessor :profile
418
+ dependencies_reader :current_account, :mailer
419
+
397
420
  validate :profile_schema
398
421
 
399
422
  step :build_record
@@ -408,27 +431,29 @@ class Profile::Create < Opera::Operation::Base
408
431
  end
409
432
 
410
433
  def build_record
411
- context[:profile] = dependencies[:current_account].profiles.build(params)
412
- context[:profile].force_name_validation = true
434
+ self.profile = current_account.profiles.build(params)
435
+ self.profile.force_name_validation = true
413
436
  end
414
437
 
415
438
  def create
416
- context[:profile] = context[:profile].save
417
- finish
439
+ self.profile = profile.save
440
+ finish!
418
441
  end
419
442
 
420
443
  def send_email
421
- return true unless dependencies[:mailer]
444
+ return true unless mailer
422
445
 
423
- dependencies[:mailer].send_mail(profile: context[:profile])
446
+ mailer.send_mail(profile: profile)
424
447
  end
425
448
 
426
449
  def output
427
- result.output(model: context[:profile])
450
+ result.output(model: profile)
428
451
  end
429
452
  end
430
453
  ```
454
+
431
455
  ##### Call
456
+
432
457
  ```ruby
433
458
  result = Profile::Create.call(params: {
434
459
  first_name: :foo,
@@ -448,6 +473,9 @@ class Profile::Create < Opera::Operation::Base
448
473
  config.transaction_class = Profile
449
474
  end
450
475
 
476
+ context_accessor :profile
477
+ dependencies_reader :current_account, :mailer
478
+
451
479
  validate :profile_schema
452
480
 
453
481
  transaction do
@@ -465,21 +493,21 @@ class Profile::Create < Opera::Operation::Base
465
493
  end
466
494
 
467
495
  def create
468
- context[:profile] = dependencies[:current_account].profiles.create(params)
496
+ self.profile = current_account.profiles.create(params)
469
497
  end
470
498
 
471
499
  def update
472
- context[:profile].update(example_attr: :Example)
500
+ profile.update(example_attr: :Example)
473
501
  end
474
502
 
475
503
  def send_email
476
- return true unless dependencies[:mailer]
504
+ return true unless mailer
477
505
 
478
- dependencies[:mailer].send_mail(profile: context[:profile])
506
+ mailer.send_mail(profile: profile)
479
507
  end
480
508
 
481
509
  def output
482
- result.output = { model: context[:profile] }
510
+ result.output = { model: profile }
483
511
  end
484
512
  end
485
513
  ```
@@ -510,6 +538,9 @@ class Profile::Create < Opera::Operation::Base
510
538
  config.transaction_class = Profile
511
539
  end
512
540
 
541
+ context_accessor :profile
542
+ dependencies_reader :current_account, :mailer
543
+
513
544
  validate :profile_schema
514
545
 
515
546
  transaction do
@@ -527,21 +558,21 @@ class Profile::Create < Opera::Operation::Base
527
558
  end
528
559
 
529
560
  def create
530
- context[:profile] = dependencies[:current_account].profiles.create(params)
561
+ self.profile = current_account.profiles.create(params)
531
562
  end
532
563
 
533
564
  def update
534
- context[:profile].update(updated_at: 1.day.ago)
565
+ profile.update(updated_at: 1.day.ago)
535
566
  end
536
567
 
537
568
  def send_email
538
- return true unless dependencies[:mailer]
569
+ return true unless mailer
539
570
 
540
- dependencies[:mailer].send_mail(profile: context[:profile])
571
+ mailer.send_mail(profile: profile)
541
572
  end
542
573
 
543
574
  def output
544
- result.output = { model: context[:profile] }
575
+ result.output = { model: profile }
545
576
  end
546
577
  end
547
578
  ```
@@ -568,6 +599,9 @@ D, [2020-08-17T12:10:44.898132 #2741] DEBUG -- : (10.3ms) COMMIT
568
599
 
569
600
  ```ruby
570
601
  class Profile::Create < Opera::Operation::Base
602
+ context_accessor :profile
603
+ dependencies_reader :current_account, :mailer
604
+
571
605
  validate :profile_schema
572
606
 
573
607
  step :create
@@ -585,21 +619,21 @@ class Profile::Create < Opera::Operation::Base
585
619
  end
586
620
 
587
621
  def create
588
- context[:profile] = dependencies[:current_account].profiles.create(params)
622
+ self.profile = current_account.profiles.create(params)
589
623
  end
590
624
 
591
625
  def update
592
- context[:profile].update(updated_at: 1.day.ago)
626
+ profile.update(updated_at: 1.day.ago)
593
627
  end
594
628
 
595
629
  def send_email
596
- return true unless dependencies[:mailer]
630
+ return true unless mailer
597
631
 
598
- dependencies[:mailer].send_mail(profile: context[:profile])
632
+ mailer.send_mail(profile: profile)
599
633
  end
600
634
 
601
635
  def output
602
- result.output = { model: context[:profile] }
636
+ result.output = { model: profile }
603
637
  end
604
638
  end
605
639
  ```
@@ -620,6 +654,9 @@ Profile::Create.call(params: {
620
654
 
621
655
  ```ruby
622
656
  class Profile::Create < Opera::Operation::Base
657
+ context_accessor :profile
658
+ dependencies_reader :current_account, :mailer
659
+
623
660
  validate :profile_schema
624
661
 
625
662
  success :populate
@@ -644,17 +681,17 @@ class Profile::Create < Opera::Operation::Base
644
681
  end
645
682
 
646
683
  def create
647
- context[:profile] = dependencies[:current_account].profiles.create(params)
684
+ self.profile = current_account.profiles.create(params)
648
685
  end
649
686
 
650
687
  def update
651
- context[:profile].update(updated_at: 1.day.ago)
688
+ profile.update(updated_at: 1.day.ago)
652
689
  end
653
690
 
654
691
  # NOTE: We can add an error in this step and it won't break the execution
655
692
  def send_email
656
693
  result.add_error('mailer', 'Missing dependency')
657
- dependencies[:mailer]&.send_mail(profile: context[:profile])
694
+ mailer&.send_mail(profile: profile)
658
695
  end
659
696
 
660
697
  def output
@@ -787,6 +824,8 @@ Opera::Operation::Result.new(output: 'success')
787
824
 
788
825
  ## Opera::Operation::Base - Class Methods
789
826
  >
827
+ - context_[reader|writer|accessor] - predefined methods for easy access
828
+ - [params|dependencies]_reader - predefined readers for immutable arguments
790
829
  - step(Symbol) - single instruction
791
830
  - return [Truthly] - continue operation execution
792
831
  - return [False] - stops operation execution
@@ -806,7 +845,7 @@ Opera::Operation::Result.new(output: 'success')
806
845
  - context [Hash] - used to pass information between steps - only for internal usage
807
846
  - params [Hash] - immutable and received in call method
808
847
  - dependencies [Hash] - immutable and received in call method
809
- - finish - this method interrupts the execution of steps after is invoked
848
+ - finish! - this method interrupts the execution of steps after is invoked
810
849
 
811
850
  ## Development
812
851
 
@@ -3,7 +3,6 @@
3
3
  module Opera
4
4
  module Operation
5
5
  class Base
6
- extend Gem::Deprecate
7
6
  include Opera::Operation::Builder
8
7
 
9
8
  attr_accessor :context
@@ -21,12 +20,6 @@ module Opera
21
20
  self.class.config
22
21
  end
23
22
 
24
- def finish
25
- finish!
26
- end
27
-
28
- deprecate :finish, :finish!, 2019, 6
29
-
30
23
  def finish!
31
24
  @finished = true
32
25
  end
@@ -54,6 +47,47 @@ module Opera
54
47
  def reporter
55
48
  config.reporter
56
49
  end
50
+
51
+ def check_method_availability!(method)
52
+ return if instance_methods(false).none?(method)
53
+
54
+ raise(ArgumentError, "Method #{method} is already defined")
55
+ end
56
+
57
+ %i[context params dependencies].each do |method|
58
+ define_method("#{method}_reader") do |*attributes, **options|
59
+ attributes.map(&:to_sym).each do |attribute|
60
+ check_method_availability!(attribute)
61
+
62
+ define_method(attribute) do
63
+ value = send(method).key?(attribute) ? send(method)[attribute] : options[:default]
64
+
65
+ if send(method).frozen?
66
+ send(method)[attribute] || value
67
+ else
68
+ send(method)[attribute] ||= value
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+ %i[context].each do |method|
76
+ define_method("#{method}_writer") do |*attributes|
77
+ attributes.map(&:to_sym).each do |attribute|
78
+ check_method_availability!("#{attribute}=")
79
+
80
+ define_method("#{attribute}=") do |value|
81
+ send(method)[attribute] = value
82
+ end
83
+ end
84
+ end
85
+
86
+ define_method("#{method}_accessor") do |*attributes, **options|
87
+ send("#{method}_reader", *attributes, **options)
88
+ send("#{method}_writer", *attributes)
89
+ end
90
+ end
57
91
  end
58
92
  end
59
93
  end
@@ -3,11 +3,12 @@
3
3
  module Opera
4
4
  module Operation
5
5
  class Config
6
- attr_accessor :transaction_class, :transaction_method, :reporter
6
+ attr_accessor :transaction_class, :transaction_method, :transaction_options, :reporter
7
7
 
8
8
  def initialize
9
9
  @transaction_class = self.class.transaction_class
10
10
  @transaction_method = self.class.transaction_method || :transaction
11
+ @transaction_options = self.class.transaction_options
11
12
  @reporter = custom_reporter || self.class.reporter
12
13
  end
13
14
 
@@ -20,7 +21,7 @@ module Opera
20
21
  end
21
22
 
22
23
  class << self
23
- attr_accessor :transaction_class, :transaction_method, :reporter
24
+ attr_accessor :transaction_class, :transaction_method, :transaction_options, :reporter
24
25
 
25
26
  def configure
26
27
  yield self
@@ -8,7 +8,8 @@ module Opera
8
8
  class RollbackTransactionError < Opera::Error; end
9
9
 
10
10
  def call(instruction)
11
- transaction_class.send(transaction_method) do
11
+ arguments = transaction_options ? [transaction_method, transaction_options] : [transaction_method]
12
+ transaction_class.send(*arguments) do
12
13
  super
13
14
 
14
15
  return if !operation.finished? && result.success?
@@ -26,6 +27,10 @@ module Opera
26
27
  def transaction_method
27
28
  config.transaction_method
28
29
  end
30
+
31
+ def transaction_options
32
+ config.transaction_options
33
+ end
29
34
  end
30
35
  end
31
36
  end
data/lib/opera/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Opera
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ProFinda Development Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-07 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-validation
@@ -59,8 +59,8 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - ".github/workflows/gem-push.yml"
63
- - ".github/workflows/ruby.yml"
62
+ - ".github/workflows/release.yml"
63
+ - ".github/workflows/specs.yml"
64
64
  - ".gitignore"
65
65
  - ".rspec"
66
66
  - ".travis.yml"
@@ -1,31 +0,0 @@
1
- name: Ruby Gem
2
-
3
- on:
4
- push:
5
- branches: [ master ]
6
-
7
- jobs:
8
- build:
9
- name: Build + Publish
10
- runs-on: ubuntu-latest
11
- permissions:
12
- contents: read
13
- packages: write
14
-
15
- steps:
16
- - uses: actions/checkout@v2
17
- - name: Set up Ruby 2.6
18
- uses: actions/setup-ruby@v1
19
- with:
20
- ruby-version: 2.6.x
21
-
22
- - name: Publish to RubyGems
23
- run: |
24
- mkdir -p $HOME/.gem
25
- touch $HOME/.gem/credentials
26
- chmod 0600 $HOME/.gem/credentials
27
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
- gem build *.gemspec
29
- gem push *.gem
30
- env:
31
- GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"