qrcode_pix_ruby 0.4.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/mergeable.yml +27 -0
- data/.github/workflows/ci.yml +4 -1
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +13 -0
- data/Dockerfile +1 -2
- data/README.md +55 -24
- data/Rakefile +2 -2
- data/demo/Dockerfile +7 -0
- data/demo/Gemfile +1 -0
- data/demo/config.ru +57 -45
- data/lib/qrcode_pix_ruby/payload.rb +22 -12
- data/lib/qrcode_pix_ruby/version.rb +1 -1
- data/lib/qrcode_pix_ruby.rb +1 -2
- metadata +5 -4
- data/.github/workflows/heroku.yml +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43111a8d138179416cd393edf5b747f3f7a171a4668a9130192b7f295b9b67b9
|
4
|
+
data.tar.gz: 2c55f8ac2b7e52eb0faec98bdf56b64cf9081137de9341fb6afaa8da7ad653f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1b002697b5de3cf6c688a29d06f8df6d90b2cc32502bdcb6409e7b177debe190321c48227175506255076e539337513b1526a870de12b9938ca982e4fda7c05
|
7
|
+
data.tar.gz: eb34d9eff0e6c22f9108fd00bf5ef5afaf8758815251e40c73331ef7caf5e50721e8cfb56d1ecbe2a48174868f4da0764b2987bc70477cbbd977e34f4e067e44
|
@@ -0,0 +1,27 @@
|
|
1
|
+
version: 2
|
2
|
+
mergeable:
|
3
|
+
- when: pull_request.opened
|
4
|
+
validate: []
|
5
|
+
pass:
|
6
|
+
- do: comment
|
7
|
+
payload:
|
8
|
+
body: Thanks for creating a pull request! A maintainer will review your changes shortly.
|
9
|
+
- when: pull_request.*
|
10
|
+
validate:
|
11
|
+
- do: description
|
12
|
+
no_empty:
|
13
|
+
enabled: true
|
14
|
+
message: Please, provide for us an awesome description to your PR 🤝
|
15
|
+
- do: dependent
|
16
|
+
changed:
|
17
|
+
file: '*'
|
18
|
+
required: ['CHANGELOG.md']
|
19
|
+
- when: schedule.repository
|
20
|
+
validate:
|
21
|
+
- do: stale
|
22
|
+
days: 3
|
23
|
+
type: pull_request, issues
|
24
|
+
pass:
|
25
|
+
- do: comment
|
26
|
+
payload:
|
27
|
+
body: It looks old 🕰️
|
data/.github/workflows/ci.yml
CHANGED
@@ -18,7 +18,7 @@ jobs:
|
|
18
18
|
runs-on: ubuntu-latest
|
19
19
|
strategy:
|
20
20
|
matrix:
|
21
|
-
ruby-version: [2.
|
21
|
+
ruby-version: [2.6, 2.7, 3.0]
|
22
22
|
env:
|
23
23
|
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
|
24
24
|
steps:
|
@@ -29,6 +29,9 @@ jobs:
|
|
29
29
|
with:
|
30
30
|
ruby-version: ${{ matrix.ruby-version }}
|
31
31
|
|
32
|
+
- name: Update rubygems
|
33
|
+
run: gem update --system
|
34
|
+
|
32
35
|
- name: Install dependencies
|
33
36
|
run: bundle install
|
34
37
|
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
- ...
|
4
|
+
|
5
|
+
## [0.6.0]- 2023-04-14
|
6
|
+
|
7
|
+
- Fixed CI
|
8
|
+
- Fixed CRC16 algorithm with rjust with 4 digits
|
9
|
+
|
10
|
+
## [0.5.0] - 2021-07-13
|
11
|
+
|
12
|
+
- Add option to pass Pix informations directly in initializer
|
13
|
+
- CI speedup
|
14
|
+
- Specs reorganization
|
15
|
+
|
3
16
|
## [0.4.0] - 2021-07-10
|
4
17
|
|
5
18
|
- Add URL option for PIX, in order to generate dynamic QR Codes
|
data/Dockerfile
CHANGED
data/README.md
CHANGED
@@ -31,27 +31,45 @@ Or install it yourself as:
|
|
31
31
|
|
32
32
|
## Usage (examples)
|
33
33
|
|
34
|
+
### Available parameters
|
35
|
+
|
36
|
+
- pix_key/url
|
37
|
+
- repeatable
|
38
|
+
- currency
|
39
|
+
- country_code
|
40
|
+
- description
|
41
|
+
- postal_code
|
42
|
+
- merchant_name
|
43
|
+
- merchant_city
|
44
|
+
- transaction_id
|
45
|
+
- amount
|
46
|
+
|
34
47
|
### Static QR Code
|
35
48
|
|
36
49
|
```ruby
|
37
50
|
require 'qrcode_pix_ruby'
|
38
51
|
|
39
|
-
pix
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
52
|
+
pix = QrcodePixRuby::Payload.new(
|
53
|
+
pix_key: 'minhachavedopix',
|
54
|
+
description: 'Pagamento do pedido 123456',
|
55
|
+
merchant_name: 'Fulano de Tal',
|
56
|
+
merchant_city: 'SAO PAULO',
|
57
|
+
transaction_id: 'TID12345',
|
58
|
+
amount: '100.00',
|
59
|
+
currency: '986',
|
60
|
+
country_code: 'BR',
|
61
|
+
postal_code: '01131010',
|
62
|
+
repeatable: false
|
63
|
+
)
|
64
|
+
|
65
|
+
# If needed, change the attributes value later
|
66
|
+
pix.pix_key = 'minhaoutrachavepix'
|
67
|
+
pix.merchant_city = 'BRASILIA'
|
50
68
|
|
51
69
|
# QRCode copia-e-cola
|
52
70
|
puts pix.payload
|
53
71
|
|
54
|
-
# QRCode
|
72
|
+
# QRCode for images
|
55
73
|
puts pix.base64
|
56
74
|
```
|
57
75
|
|
@@ -60,13 +78,18 @@ puts pix.base64
|
|
60
78
|
```ruby
|
61
79
|
require 'qrcode_pix_ruby'
|
62
80
|
|
63
|
-
pix
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
81
|
+
pix = QrcodePixRuby::Payload.new(
|
82
|
+
url: 'https://example.com',
|
83
|
+
merchant_name: 'Fulano de Tal',
|
84
|
+
merchant_city: 'SAO PAULO',
|
85
|
+
amount: '100.00',
|
86
|
+
transaction_id: 'TID12345',
|
87
|
+
repeatable: false
|
88
|
+
)
|
89
|
+
|
90
|
+
# If needed, change the attributes value later
|
91
|
+
pix.url = 'https://another-example.com'
|
92
|
+
pix.amount = 1.50
|
70
93
|
|
71
94
|
# QRCode copia-e-cola
|
72
95
|
puts pix.payload
|
@@ -77,7 +100,7 @@ puts pix.base64
|
|
77
100
|
|
78
101
|
🚨 Important note: BACEN (Banco Central do Brasil) sets a variety of rules for each field in QRCode Payload (maximum number of characters, invalid values, mandatory and optional fields, and so on). So, pay attention that a QRCode payload+base64 generated by the gem can be valid, theorically, but may not be accepted in banking apps because of these restrictions (that are out of scope of gem).
|
79
102
|
|
80
|
-
## Execute tests/specs
|
103
|
+
## Execute tests/specs locally
|
81
104
|
|
82
105
|
To execute gem tests locally, use Docker with the commands below:
|
83
106
|
|
@@ -92,13 +115,18 @@ docker build -t qrcode_pix_ruby_specs .
|
|
92
115
|
docker run -v $(pwd):/app/ -it qrcode_pix_ruby_specs
|
93
116
|
```
|
94
117
|
|
95
|
-
##
|
118
|
+
## Execute demo locally
|
96
119
|
|
97
|
-
|
120
|
+
To execute demo locally, use Docker with the commands below:
|
98
121
|
|
99
|
-
|
122
|
+
```bash
|
123
|
+
git clone https://github.com/pedrofurtado/qrcode_pix_ruby
|
124
|
+
cd qrcode_pix_ruby/demo/
|
125
|
+
docker build -t qrcode_pix_ruby_demo .
|
100
126
|
|
101
|
-
|
127
|
+
# Then, access http://localhost:3000 the see demo in action.
|
128
|
+
docker run -p 3000:3000 -it qrcode_pix_ruby_demo
|
129
|
+
```
|
102
130
|
|
103
131
|
## Useful links
|
104
132
|
|
@@ -125,6 +153,9 @@ https://qrcode-pix-ruby.herokuapp.com
|
|
125
153
|
* https://github.com/EnssureIT/faz-um-pix
|
126
154
|
* https://github.com/jesobreira/pixkey
|
127
155
|
* https://github.com/pedrinholemes/pix-br
|
156
|
+
* https://github.com/ceciliadeveza/gerarqrcodepix
|
157
|
+
* https://www.bcb.gov.br/content/estabilidadefinanceira/SiteAssets/Manual%20do%20BR%20Code.pdf
|
158
|
+
* https://www.bcb.gov.br/content/estabilidadefinanceira/spb_docs/ManualBRCode.pdf
|
128
159
|
|
129
160
|
## Contributing
|
130
161
|
|
data/Rakefile
CHANGED
data/demo/Dockerfile
ADDED
data/demo/Gemfile
CHANGED
data/demo/config.ru
CHANGED
@@ -4,22 +4,15 @@ require 'qrcode_pix_ruby'
|
|
4
4
|
|
5
5
|
def generate_html_with(env)
|
6
6
|
qrcode_data = Rack::Request.new(env).params
|
7
|
-
payload
|
8
|
-
data_uri
|
9
|
-
pix
|
7
|
+
payload = ''
|
8
|
+
data_uri = ''
|
9
|
+
pix = QrcodePixRuby::Payload.new
|
10
10
|
|
11
11
|
unless qrcode_data.empty?
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
pix.merchant_city = qrcode_data['merchant_city'] unless qrcode_data['merchant_city'].nil?
|
17
|
-
pix.transaction_id = qrcode_data['transaction_id'] unless qrcode_data['transaction_id'].nil?
|
18
|
-
pix.amount = qrcode_data['amount'] unless qrcode_data['amount'].nil?
|
19
|
-
pix.currency = qrcode_data['currency'] unless qrcode_data['currency'].nil?
|
20
|
-
pix.country_code = qrcode_data['country_code'] unless qrcode_data['country_code'].nil?
|
21
|
-
pix.postal_code = qrcode_data['postal_code'] unless qrcode_data['postal_code'].nil?
|
22
|
-
pix.repeatable = qrcode_data['repeatable'] == 't' unless qrcode_data['repeatable'].nil?
|
12
|
+
qrcode_data.keys.each do |key|
|
13
|
+
v = qrcode_data[key]
|
14
|
+
pix.public_send("#{key}=", key == 'repeatable' ? v == 't' : v) unless v.empty? || v.nil?
|
15
|
+
end
|
23
16
|
|
24
17
|
payload = <<-HTML
|
25
18
|
<label for='payload'>Payload</label>
|
@@ -29,7 +22,7 @@ def generate_html_with(env)
|
|
29
22
|
</div>
|
30
23
|
HTML
|
31
24
|
|
32
|
-
data_uri = "<img style='max-width: 100%;' src='#{pix.base64}'>"
|
25
|
+
data_uri = "<img style='max-width: 100%; display: block; margin: 0 auto;' src='#{pix.base64}'>"
|
33
26
|
end
|
34
27
|
|
35
28
|
StringIO.new <<-HTML
|
@@ -61,60 +54,81 @@ def generate_html_with(env)
|
|
61
54
|
<strong>QRCode informations</strong>
|
62
55
|
<br>
|
63
56
|
<br>
|
64
|
-
<form action='
|
57
|
+
<form action='/' method='post'>
|
65
58
|
<div class='mb-3'>
|
66
|
-
<
|
59
|
+
<div class='form-text'>
|
60
|
+
For static Pix, please fill the 'Pix key' field.<br>
|
61
|
+
For dynamic Pix, fill the 'URL' field.<br>
|
62
|
+
Do not fill both fields.
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
<div class='mb-3'>
|
66
|
+
<label for='pix_key'>* Pix key</label>
|
67
67
|
<input type='text' class='form-control' id='pix_key' value='#{qrcode_data["pix_key"]}' name='pix_key'>
|
68
|
+
<div class='form-text'>
|
69
|
+
Formats of Pix keys:<br>
|
70
|
+
CPF: 12345678910 (only numbers)<br>
|
71
|
+
Phone: +5511912345678 (+55 + DDD + phone, only numbers)<br>
|
72
|
+
Email: example@mail.com<br>
|
73
|
+
Random: a6hf7jdk3nc8iK (generated by bank)
|
74
|
+
</div>
|
68
75
|
</div>
|
76
|
+
<div class='mb-3 text-center'> or</div>
|
69
77
|
<div class='mb-3'>
|
70
|
-
<label for='url'
|
71
|
-
<input type='
|
78
|
+
<label for='url'>* URL</label>
|
79
|
+
<input type='url' pattern='https?:\/\/.+' class='form-control' id='url' value='#{qrcode_data["url"]}' name='url'>
|
72
80
|
</div>
|
81
|
+
<hr>
|
73
82
|
<div class='mb-3'>
|
74
|
-
<label for='
|
75
|
-
<input required type='text' class='form-control' id='
|
83
|
+
<label for='merchant_name'>* Merchant name</label>
|
84
|
+
<input required maxlength='10' type='text' class='form-control' id='merchant_name' value='#{qrcode_data["merchant_name"]}' name='merchant_name'>
|
76
85
|
</div>
|
77
86
|
<div class='mb-3'>
|
78
|
-
<label for='
|
79
|
-
<input required type='text' class='form-control' id='
|
87
|
+
<label for='merchant_city'>* Merchant city</label>
|
88
|
+
<input required maxlength='10' type='text' class='form-control' id='merchant_city' value='#{qrcode_data["merchant_city"]}' name='merchant_city'>
|
80
89
|
</div>
|
81
90
|
<div class='mb-3'>
|
82
|
-
<label for='
|
83
|
-
<
|
91
|
+
<label for='country_code'>* Country</label>
|
92
|
+
<select required id='country_code' name='country_code' class='form-select'>
|
93
|
+
<option></option>
|
94
|
+
<option value='BR' #{qrcode_data['country_code'] == 'BR' ? 'selected' : ''}>Brazil</option>
|
95
|
+
</select>
|
84
96
|
</div>
|
85
97
|
<div class='mb-3'>
|
86
|
-
<label for='
|
87
|
-
<
|
98
|
+
<label for='currency'>* Currency</label>
|
99
|
+
<select required id='currency' name='currency' class='form-select'>
|
100
|
+
<option></option>
|
101
|
+
<option value='986' #{qrcode_data['currency'] == '986' ? 'selected' : ''}>Brazilian Real (R$)</option>
|
102
|
+
</select>
|
88
103
|
</div>
|
89
104
|
<div class='mb-3'>
|
90
|
-
<label for='
|
91
|
-
<input
|
105
|
+
<label for='description'>Description</label>
|
106
|
+
<input maxlength='10' type='text' class='form-control' id='description' value='#{qrcode_data["description"]}' name='description'>
|
92
107
|
</div>
|
93
108
|
<div class='mb-3'>
|
94
|
-
<label for='
|
95
|
-
<
|
96
|
-
|
97
|
-
</select>
|
109
|
+
<label for='transaction_id'>Transaction ID</label>
|
110
|
+
<input maxlength='10' pattern='[a-zA-z0-9]*' type='text' class='form-control' id='transaction_id' value='#{qrcode_data["transaction_id"]}' name='transaction_id'>
|
111
|
+
<div class='form-text'>Only numbers and simple characters, without whitespaces.</div>
|
98
112
|
</div>
|
99
113
|
<div class='mb-3'>
|
100
|
-
<label for='
|
101
|
-
<
|
102
|
-
|
103
|
-
</select>
|
114
|
+
<label for='amount'>Amount</label>
|
115
|
+
<input type='number' step='0.01' pattern='[0-9]{1,}\.[0-9][0-9]' class='form-control' id='amount' value='#{qrcode_data["amount"]}' name='amount'>
|
116
|
+
<div class='form-text'>Only numbers with 2 decimal places.</div>
|
104
117
|
</div>
|
105
118
|
<div class='mb-3'>
|
106
119
|
<label for='postal_code'>Postal code</label>
|
107
|
-
<input type='
|
120
|
+
<input maxlength='8' pattern='[0-9]{8}' type='tel' class='form-control' id='postal_code' value='#{qrcode_data["postal_code"]}' name='postal_code'>
|
121
|
+
<div class='form-text'>Only numbers.</div>
|
108
122
|
</div>
|
109
123
|
<div class='mb-3'>
|
110
|
-
<label for='repeatable'>
|
124
|
+
<label for='repeatable'>Can be paid multiple times?</label>
|
111
125
|
<select required id='repeatable' name='repeatable' class='form-select'>
|
112
|
-
<option
|
113
|
-
<option value='t'>Yes</option>
|
114
|
-
<option value='f'>No</option>
|
126
|
+
<option></option>
|
127
|
+
<option value='t' #{qrcode_data['repeatable'] == 't' ? 'selected' : ''}>Yes</option>
|
128
|
+
<option value='f' #{qrcode_data['repeatable'] == 'f' ? 'selected' : ''}>No</option>
|
115
129
|
</select>
|
116
130
|
</div>
|
117
|
-
<div class='d-grid gap-2'>
|
131
|
+
<div class='d-grid gap-2' style='padding-bottom: 20px;'>
|
118
132
|
<button type='submit' class='btn btn-lg btn-primary'>Generate</button>
|
119
133
|
</div>
|
120
134
|
</form>
|
@@ -124,8 +138,6 @@ def generate_html_with(env)
|
|
124
138
|
<br>
|
125
139
|
<br>
|
126
140
|
#{payload}
|
127
|
-
<br>
|
128
|
-
<br>
|
129
141
|
#{data_uri}
|
130
142
|
</div>
|
131
143
|
</div>
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'rqrcode'
|
4
4
|
|
5
5
|
module QrcodePixRuby
|
6
|
+
class PayloadArgumentError < ArgumentError; end
|
7
|
+
|
6
8
|
class Payload
|
7
9
|
ID_PAYLOAD_FORMAT_INDICATOR = '00'
|
8
10
|
ID_POINT_OF_INITIATION_METHOD = '01'
|
@@ -22,17 +24,17 @@ module QrcodePixRuby
|
|
22
24
|
ID_ADDITIONAL_DATA_FIELD_TEMPLATE_TXID = '05'
|
23
25
|
ID_CRC16 = '63'
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
ATTRIBUTES = %i[pix_key url repeatable currency country_code description postal_code
|
28
|
+
merchant_name merchant_city transaction_id amount].freeze
|
29
|
+
|
30
|
+
def initialize(**kwargs)
|
31
|
+
verify_kwargs(kwargs.keys)
|
32
|
+
|
33
|
+
ATTRIBUTES.each do |attribute|
|
34
|
+
singleton_class.class_eval { attr_accessor attribute }
|
35
|
+
instance_variable_set("@#{attribute}", kwargs[attribute])
|
36
|
+
end
|
37
|
+
end
|
36
38
|
|
37
39
|
def payload
|
38
40
|
p = ''
|
@@ -68,6 +70,14 @@ module QrcodePixRuby
|
|
68
70
|
|
69
71
|
private
|
70
72
|
|
73
|
+
def verify_kwargs(keys)
|
74
|
+
unknowns = keys - ATTRIBUTES
|
75
|
+
|
76
|
+
return unless unknowns.any?
|
77
|
+
|
78
|
+
raise QrcodePixRuby::PayloadArgumentError, "Unknown attributes: #{unknowns.join(', ')}"
|
79
|
+
end
|
80
|
+
|
71
81
|
def emv(id, value)
|
72
82
|
size = value.to_s.length.to_s.rjust(2, '0')
|
73
83
|
"#{id}#{size}#{value}"
|
@@ -114,7 +124,7 @@ module QrcodePixRuby
|
|
114
124
|
end
|
115
125
|
end
|
116
126
|
|
117
|
-
"#{ID_CRC16}04#{result.to_s(16).upcase}"
|
127
|
+
"#{ID_CRC16}04#{result.to_s(16).upcase.rjust(4, '0')}"
|
118
128
|
end
|
119
129
|
end
|
120
130
|
end
|
data/lib/qrcode_pix_ruby.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qrcode_pix_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Furtado
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-04-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rqrcode
|
@@ -80,8 +80,8 @@ executables: []
|
|
80
80
|
extensions: []
|
81
81
|
extra_rdoc_files: []
|
82
82
|
files:
|
83
|
+
- ".github/mergeable.yml"
|
83
84
|
- ".github/workflows/ci.yml"
|
84
|
-
- ".github/workflows/heroku.yml"
|
85
85
|
- ".github/workflows/rubygems.yml"
|
86
86
|
- ".gitignore"
|
87
87
|
- ".rspec"
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- Rakefile
|
96
96
|
- bin/console
|
97
97
|
- bin/setup
|
98
|
+
- demo/Dockerfile
|
98
99
|
- demo/Gemfile
|
99
100
|
- demo/config.ru
|
100
101
|
- lib/qrcode_pix_ruby.rb
|
@@ -124,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
125
|
- !ruby/object:Gem::Version
|
125
126
|
version: '0'
|
126
127
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.4.10
|
128
129
|
signing_key:
|
129
130
|
specification_version: 4
|
130
131
|
summary: Ruby gem for Qrcode generation of Pix (Pagamento Instantâneo Brasileiro -
|
@@ -1,50 +0,0 @@
|
|
1
|
-
name: Publish to Heroku
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [master]
|
6
|
-
|
7
|
-
jobs:
|
8
|
-
deploy:
|
9
|
-
runs-on: ubuntu-latest
|
10
|
-
steps:
|
11
|
-
- uses: actions/checkout@v2
|
12
|
-
|
13
|
-
- name: Install Ruby
|
14
|
-
uses: ruby/setup-ruby@v1
|
15
|
-
with:
|
16
|
-
ruby-version: 3.0
|
17
|
-
|
18
|
-
- name: Install dependencies
|
19
|
-
run: |
|
20
|
-
cd demo/
|
21
|
-
bundle install
|
22
|
-
bundle update qrcode_pix_ruby
|
23
|
-
cd ../
|
24
|
-
|
25
|
-
- name: Define Heroku credentials
|
26
|
-
run: |
|
27
|
-
cat > ~/.netrc <<EOF
|
28
|
-
machine api.heroku.com
|
29
|
-
login $HEROKU_EMAIL
|
30
|
-
password $HEROKU_API_KEY
|
31
|
-
machine git.heroku.com
|
32
|
-
login $HEROKU_EMAIL
|
33
|
-
password $HEROKU_API_KEY
|
34
|
-
EOF
|
35
|
-
env:
|
36
|
-
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
|
37
|
-
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
|
38
|
-
|
39
|
-
- name: Define Heroku git remote
|
40
|
-
run: heroku git:remote --app $HEROKU_APP_NAME
|
41
|
-
env:
|
42
|
-
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
|
43
|
-
|
44
|
-
- name: Publish to Heroku
|
45
|
-
run: |
|
46
|
-
git config user.name 'Pedro Furtado'
|
47
|
-
git config user.email 'pedro.felipe.azevedo.furtado@gmail.com'
|
48
|
-
git add --all
|
49
|
-
git commit -m 'Publish to Heroku'
|
50
|
-
git push heroku `git subtree split --prefix demo master`:master --force
|