create_github_release 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/.solargraph.yml +23 -0
- data/.vscode/launch.json +19 -0
- data/CHANGELOG.md +18 -0
- data/README.md +10 -10
- data/Rakefile +8 -5
- data/create_github_release.gemspec +6 -3
- data/exe/create-github-release +4 -0
- data/lib/create_github_release/assertion_base.rb +0 -2
- data/lib/create_github_release/command_line_options.rb +29 -18
- data/lib/create_github_release/command_line_parser.rb +8 -4
- data/lib/create_github_release/project.rb +22 -22
- data/lib/create_github_release/release_assertions.rb +2 -1
- data/lib/create_github_release/release_tasks.rb +2 -1
- data/lib/create_github_release/tasks/update_version.rb +12 -13
- data/lib/create_github_release/version.rb +1 -1
- metadata +40 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c7135b3a301cc4504b3eb3b5bbb68f8f22d095e7f3edcf95044aa24ce0810b3
|
4
|
+
data.tar.gz: 4a59c7be79e6b571b3bafa683213c03b283468dc36e4e5766e0d9264ea70aa6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f40d6c1141f6e3ff94b5fc2532dd1c73149b2ae5f2c4fba6a7ea2a79597a592080327ae749f9373c45ae0c9c82ef286455b4265b1949575e95f640f47e64dd53
|
7
|
+
data.tar.gz: 124bf8d9ed03b6d82d902e63acae142298000062bfb4ff9409e3e31f98f4d83f8c24de85263de788478213c567c6cbf08308003b5d6d846ac044884ef7188dd2
|
data/.rubocop.yml
CHANGED
@@ -7,7 +7,7 @@ AllCops:
|
|
7
7
|
SuggestExtensions: false
|
8
8
|
# RuboCop enforces rules depending on the oldest version of Ruby which
|
9
9
|
# your project supports:
|
10
|
-
TargetRubyVersion:
|
10
|
+
TargetRubyVersion: 3.0
|
11
11
|
|
12
12
|
# The default max line length is 80 characters
|
13
13
|
Layout/LineLength:
|
@@ -18,3 +18,6 @@ Metrics/BlockLength:
|
|
18
18
|
Exclude:
|
19
19
|
- "spec/**/*_spec.rb"
|
20
20
|
- "*.gemspec"
|
21
|
+
|
22
|
+
Gemspec/DevelopmentDependencies:
|
23
|
+
EnforcedStyle: gemspec
|
data/.solargraph.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
include:
|
3
|
+
- "**/*.rb"
|
4
|
+
exclude:
|
5
|
+
- spec/**/*
|
6
|
+
- test/**/*
|
7
|
+
- vendor/**/*
|
8
|
+
- ".bundle/**/*"
|
9
|
+
require: []
|
10
|
+
domains: []
|
11
|
+
reporters:
|
12
|
+
- rubocop
|
13
|
+
- require_not_found
|
14
|
+
- typecheck:strict
|
15
|
+
formatter:
|
16
|
+
rubocop:
|
17
|
+
cops: safe
|
18
|
+
except: []
|
19
|
+
only: []
|
20
|
+
extra_args: []
|
21
|
+
require_paths: []
|
22
|
+
plugins: []
|
23
|
+
max_files: 5000
|
data/.vscode/launch.json
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
// Test
|
3
|
+
"version": "0.2.0",
|
4
|
+
"configurations": [
|
5
|
+
{
|
6
|
+
"type": "rdbg",
|
7
|
+
"name": "Debug current file with rdbg",
|
8
|
+
"request": "launch",
|
9
|
+
"script": "${file}",
|
10
|
+
"args": [],
|
11
|
+
"askParameters": false
|
12
|
+
},
|
13
|
+
{
|
14
|
+
"type": "rdbg",
|
15
|
+
"name": "Attach with rdbg",
|
16
|
+
"request": "attach"
|
17
|
+
}
|
18
|
+
]
|
19
|
+
}
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## v1.1.0 (2023-10-15)
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/main-branch/create_github_release/compare/v1.0.0..v1.1.0)
|
11
|
+
|
12
|
+
Changes since v1.0.0:
|
13
|
+
|
14
|
+
* 5088cd0 Add instruction for publishing the resulting gem (#41)
|
15
|
+
* 60553b0 Integrate solargraph:typecheck into Rake and fix any problems (#40)
|
16
|
+
* c0dd2d8 Improve reporting of code not covered by tests (#38)
|
17
|
+
* 5dff0b5 Tell rubocop development dependencies go in the gemspec (#39)
|
18
|
+
* d55f2f4 Merge pull request #37 from main-branch/debugging_support
|
19
|
+
* 4a28c4c Allow the build to continue if the Ruby head build fails
|
20
|
+
* 2814761 Add launch.json to run the ruby debugger in VS Code
|
21
|
+
* c3de36d Require 'debug' in spec_helper so `binding.break` can be used
|
22
|
+
* 3f3276d Add gems needed for debugging
|
23
|
+
* e299d97 Replace 'bump' with 'semverify' (#35)
|
24
|
+
* 68fa672 Drop support for Ruby 2.7 and require at least Ruby 3.0 (#36)
|
25
|
+
|
8
26
|
## v1.0.0 (2023-02-05)
|
9
27
|
|
10
28
|
[Full Changelog](https://github.com/main-branch/create_github_release/compare/v0.3.0..v1.0.0)
|
data/README.md
CHANGED
@@ -52,9 +52,9 @@ Options:
|
|
52
52
|
--release-branch=BRANCH_NAME Override the release branch to create
|
53
53
|
--remote=REMOTE_NAME Use this remote name instead of 'origin'
|
54
54
|
--last-release-version=VERSION
|
55
|
-
Use this version instead `
|
55
|
+
Use this version instead `semverify current`
|
56
56
|
--next-release-version=VERSION
|
57
|
-
Use this version instead `
|
57
|
+
Use this version instead `semverify RELEASE_TYPE`
|
58
58
|
--changelog-path=PATH Use this file instead of CHANGELOG.md
|
59
59
|
-q, --[no-]quiet Do not show output
|
60
60
|
-v, --[no-]verbose Show extra output
|
@@ -76,10 +76,10 @@ If this is to be the first release of this gem follow these instructions.
|
|
76
76
|
For this use case, let's assume the following:
|
77
77
|
|
78
78
|
* the default branch is `main` (this is the HEAD branch returned by `git remote show origin`)
|
79
|
-
* the current version of the gem is `0.1.0` (as returned by `
|
79
|
+
* the current version of the gem is `0.1.0` (as returned by `semverify current`)
|
80
80
|
|
81
81
|
If a different first version number is desired, update the version number in the
|
82
|
-
source code making sure that `
|
82
|
+
source code making sure that `semverify current` returns the desired version number.
|
83
83
|
Then commit the change to the default branch on the remote before running this
|
84
84
|
script.
|
85
85
|
|
@@ -117,7 +117,7 @@ create-github-release first
|
|
117
117
|
|
118
118
|
The `create-github-release` script will do the following:
|
119
119
|
|
120
|
-
* Determine the next-release version (`v0.1.0`) using `
|
120
|
+
* Determine the next-release version (`v0.1.0`) using `semverify current`
|
121
121
|
* Update the project's changelog file `CHANGELOG.md`
|
122
122
|
* Create a release branch `release-v0.1.0`
|
123
123
|
* Commit the changes to the changelog and create a release tag (`v0.1.0`) pointing
|
@@ -134,7 +134,7 @@ In order to start using `create-github-release` after you have used some other
|
|
134
134
|
method for managing the gem version and creating releases, you need to ensure the
|
135
135
|
following prerequisites are met:
|
136
136
|
|
137
|
-
1. that `
|
137
|
+
1. that `semverify current` is the version of the last release (let's use `1.3.1` as an
|
138
138
|
example).
|
139
139
|
2. that there is a corresponding release tag that points to the last commit on the
|
140
140
|
default branch of the previous release. If the last version was `1.3.1`, then
|
@@ -159,7 +159,7 @@ For this use case, let's assume the following:
|
|
159
159
|
|
160
160
|
* you want to create a `major` release
|
161
161
|
* the default branch is `main` (this is the HEAD branch returned by `git remote show origin`)
|
162
|
-
* the current version of the gem is `0.1.0` (as returned by `
|
162
|
+
* the current version of the gem is `0.1.0` (as returned by `semverify current`)
|
163
163
|
|
164
164
|
The following prerequisites must be met:
|
165
165
|
|
@@ -182,9 +182,9 @@ create-github-release major
|
|
182
182
|
|
183
183
|
The `create-github-release` script will do the following:
|
184
184
|
|
185
|
-
* Determine the last-release version using `
|
186
|
-
* Determine the next-release version using `
|
187
|
-
*
|
185
|
+
* Determine the last-release version using `semverify current`
|
186
|
+
* Determine the next-release version using `semverify RELEASE_TYPE --dry-run`
|
187
|
+
* Increment the project's version using `semverify RELEASE_TYPE`
|
188
188
|
* Update the project's changelog file `CHANGELOG.md`
|
189
189
|
* Create a release branch `release-v1.0.0`
|
190
190
|
* Commit the changes to the version and changelog AND create a release tag (`v1.0.0`) pointing
|
data/Rakefile
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# The default task
|
4
4
|
|
5
5
|
desc 'Run the same tasks that the CI build will run'
|
6
|
-
task default: %w[spec rubocop yard yard:audit yard:coverage bundle:audit build]
|
6
|
+
task default: %w[spec rubocop yard yard:audit yard:coverage solargraph:typecheck bundle:audit build]
|
7
7
|
|
8
8
|
# Bundler Audit
|
9
9
|
|
@@ -26,10 +26,6 @@ end
|
|
26
26
|
CLEAN << 'pkg'
|
27
27
|
CLOBBER << 'Gemfile.lock'
|
28
28
|
|
29
|
-
# Bump
|
30
|
-
|
31
|
-
require 'bump/tasks'
|
32
|
-
|
33
29
|
# RSpec
|
34
30
|
|
35
31
|
require 'rspec/core/rake_task'
|
@@ -79,6 +75,13 @@ Yardstick::Rake::Verify.new(:'yard:coverage') do |verify|
|
|
79
75
|
verify.threshold = 100
|
80
76
|
end
|
81
77
|
|
78
|
+
# Solargraph typecheck
|
79
|
+
|
80
|
+
desc 'Run the solargraph type checker'
|
81
|
+
task :'solargraph:typecheck' do
|
82
|
+
sh 'bundle exec solargraph typecheck --level=typed'
|
83
|
+
end
|
84
|
+
|
82
85
|
# Additional cleanup
|
83
86
|
|
84
87
|
CLEAN << 'tmp'
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
DESCRIPTION
|
16
16
|
spec.homepage = 'https://github.com/main-branch/create_github_release'
|
17
17
|
spec.license = 'MIT'
|
18
|
-
spec.required_ruby_version = '>=
|
18
|
+
spec.required_ruby_version = '>= 3.0.0'
|
19
19
|
|
20
20
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
21
21
|
|
@@ -34,15 +34,18 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
35
35
|
spec.require_paths = ['lib']
|
36
36
|
|
37
|
-
spec.
|
37
|
+
spec.add_runtime_dependency 'semverify', '~> 0.3'
|
38
|
+
|
38
39
|
spec.add_development_dependency 'bundler-audit', '~> 0.9'
|
40
|
+
spec.add_development_dependency 'debug', '~> 1.7'
|
39
41
|
spec.add_development_dependency 'rake', '~> 13.0'
|
40
42
|
spec.add_development_dependency 'redcarpet', '~> 3.5'
|
41
43
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
42
44
|
spec.add_development_dependency 'rubocop', '~> 1.36'
|
45
|
+
spec.add_development_dependency 'ruby-debug-ide', '~> 0.7'
|
43
46
|
spec.add_development_dependency 'simplecov', '~> 0.21'
|
44
47
|
spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
|
45
|
-
spec.add_development_dependency 'solargraph', '~> 0.
|
48
|
+
spec.add_development_dependency 'solargraph', '~> 0.49'
|
46
49
|
spec.add_development_dependency 'timecop', '~> 0.9'
|
47
50
|
spec.add_development_dependency 'yard', '~> 0.9'
|
48
51
|
spec.add_development_dependency 'yardstick', '~> 0.9'
|
data/exe/create-github-release
CHANGED
@@ -23,4 +23,8 @@ puts <<~MESSAGE unless project.quiet
|
|
23
23
|
git checkout #{project.default_branch}
|
24
24
|
git merge --ff-only #{project.release_branch}
|
25
25
|
git push
|
26
|
+
|
27
|
+
Wait for the CI build to pass and then release the gem with the following command:
|
28
|
+
|
29
|
+
rake release:rubygem_push
|
26
30
|
MESSAGE
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'uri'
|
4
4
|
|
5
|
-
# rubocop:disable Metrics/ModuleLength
|
6
|
-
|
7
5
|
module CreateGithubRelease
|
8
6
|
# An array of the valid release types
|
9
7
|
# @return [Array<String>]
|
@@ -13,7 +11,14 @@ module CreateGithubRelease
|
|
13
11
|
# Regex pattern for a [valid git reference](https://git-scm.com/docs/git-check-ref-format)
|
14
12
|
# @return [Regexp]
|
15
13
|
# @api private
|
16
|
-
VALID_REF_PATTERN = /^(?:(?:[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*)|(?:[a-zA-Z0-9-]+))
|
14
|
+
VALID_REF_PATTERN = /^(?:(?:[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*)|(?:[a-zA-Z0-9-]+))$/
|
15
|
+
|
16
|
+
# An array of the allowed options that can be passed to `.new`
|
17
|
+
# @return [Array<Symbol>]
|
18
|
+
ALLOWED_OPTIONS = %i[
|
19
|
+
release_type default_branch release_branch remote last_release_version
|
20
|
+
next_release_version changelog_path quiet verbose
|
21
|
+
].freeze
|
17
22
|
|
18
23
|
# rubocop:disable Metrics/ClassLength
|
19
24
|
|
@@ -27,11 +32,9 @@ module CreateGithubRelease
|
|
27
32
|
#
|
28
33
|
# @api public
|
29
34
|
#
|
30
|
-
CommandLineOptions
|
31
|
-
|
32
|
-
|
33
|
-
keyword_init: true
|
34
|
-
) do
|
35
|
+
class CommandLineOptions
|
36
|
+
ALLOWED_OPTIONS.each { |option| attr_accessor option }
|
37
|
+
|
35
38
|
# @attribute release_type [rw] the type of release to create
|
36
39
|
#
|
37
40
|
# Must be one of the VALID_RELEASE_TYPES
|
@@ -129,11 +132,14 @@ module CreateGithubRelease
|
|
129
132
|
# @yieldparam self [CreateGithubRelease::CommandLineOptions] the instance being initialized
|
130
133
|
# @yieldreturn [void] the return value is ignored
|
131
134
|
#
|
132
|
-
def initialize(
|
133
|
-
|
135
|
+
def initialize(**options)
|
136
|
+
assert_no_unknown_options(options)
|
137
|
+
options.each { |k, v| instance_variable_set("@#{k}", v) }
|
138
|
+
|
134
139
|
self.quiet ||= false
|
135
140
|
self.verbose ||= false
|
136
141
|
@errors = []
|
142
|
+
|
137
143
|
yield(self) if block_given?
|
138
144
|
end
|
139
145
|
|
@@ -192,6 +198,17 @@ module CreateGithubRelease
|
|
192
198
|
|
193
199
|
private
|
194
200
|
|
201
|
+
# Raise ArgumentError if options has a key not in ALLOWED_OPTIONS
|
202
|
+
# @return [void]
|
203
|
+
# @api private
|
204
|
+
def assert_no_unknown_options(options)
|
205
|
+
unknown_options = options.keys - ALLOWED_OPTIONS
|
206
|
+
return if unknown_options.empty?
|
207
|
+
|
208
|
+
message = "Unknown keywords: #{unknown_options.join(', ')}"
|
209
|
+
raise ArgumentError, message
|
210
|
+
end
|
211
|
+
|
195
212
|
# Returns `true` if the given name is a valid git reference
|
196
213
|
# @return [Boolean]
|
197
214
|
# @api private
|
@@ -229,19 +246,13 @@ module CreateGithubRelease
|
|
229
246
|
false
|
230
247
|
end
|
231
248
|
|
232
|
-
# Returns a string representation of the valid release types
|
233
|
-
# @return [String]
|
234
|
-
# @api private
|
235
|
-
def valid_release_types
|
236
|
-
"'#{VALID_RELEASE_TYPES.join("', '")}'"
|
237
|
-
end
|
238
|
-
|
239
249
|
# Returns `true` if the `#release_type` is not nil
|
240
250
|
# @return [Boolean]
|
241
251
|
# @api private
|
242
252
|
def validate_release_type_given
|
243
253
|
return true unless release_type.nil?
|
244
254
|
|
255
|
+
valid_release_types = "'#{VALID_RELEASE_TYPES.join("', '")}'"
|
245
256
|
@errors << "RELEASE_TYPE must be given and be one of #{valid_release_types}"
|
246
257
|
false
|
247
258
|
end
|
@@ -252,6 +263,7 @@ module CreateGithubRelease
|
|
252
263
|
def validate_release_type
|
253
264
|
return true if release_type.nil? || VALID_RELEASE_TYPES.include?(release_type)
|
254
265
|
|
266
|
+
valid_release_types = "'#{VALID_RELEASE_TYPES.join("', '")}'"
|
255
267
|
@errors << "RELEASE_TYPE '#{release_type}' is not valid. Must be one of #{valid_release_types}"
|
256
268
|
false
|
257
269
|
end
|
@@ -364,4 +376,3 @@ module CreateGithubRelease
|
|
364
376
|
end
|
365
377
|
# rubocop:enable Metrics/ClassLength
|
366
378
|
end
|
367
|
-
# rubocop:enable Metrics/ModuleLength
|
@@ -46,7 +46,7 @@ module CreateGithubRelease
|
|
46
46
|
#
|
47
47
|
# @param args [Array<String>] the command line arguments
|
48
48
|
#
|
49
|
-
# @return [CreateGithubRelease::
|
49
|
+
# @return [CreateGithubRelease::CommandLineOptions] the options
|
50
50
|
#
|
51
51
|
def parse(*args)
|
52
52
|
begin
|
@@ -72,7 +72,7 @@ module CreateGithubRelease
|
|
72
72
|
# options = parser.options
|
73
73
|
# options.release_type # => 'major'
|
74
74
|
#
|
75
|
-
# @return [CreateGithubRelease::
|
75
|
+
# @return [CreateGithubRelease::CommandLineOptions] the options
|
76
76
|
#
|
77
77
|
# @api private
|
78
78
|
#
|
@@ -128,6 +128,7 @@ module CreateGithubRelease
|
|
128
128
|
# @return [void]
|
129
129
|
# @api private
|
130
130
|
def define_options
|
131
|
+
# @sg-ignore
|
131
132
|
option_parser.banner = "Usage:\n#{command_template}"
|
132
133
|
option_parser.separator ''
|
133
134
|
option_parser.separator "RELEASE_TYPE must be 'major', 'minor', or 'patch'"
|
@@ -199,7 +200,7 @@ module CreateGithubRelease
|
|
199
200
|
# @return [void]
|
200
201
|
# @api private
|
201
202
|
def define_last_release_version_option
|
202
|
-
option_parser.on('--last-release-version=VERSION', 'Use this version instead `
|
203
|
+
option_parser.on('--last-release-version=VERSION', 'Use this version instead `semverify current`') do |version|
|
203
204
|
options.last_release_version = version
|
204
205
|
end
|
205
206
|
end
|
@@ -208,7 +209,10 @@ module CreateGithubRelease
|
|
208
209
|
# @return [void]
|
209
210
|
# @api private
|
210
211
|
def define_next_release_version_option
|
211
|
-
option_parser.on(
|
212
|
+
option_parser.on(
|
213
|
+
'--next-release-version=VERSION',
|
214
|
+
'Use this version instead `semverify next-RELEASE_TYPE`'
|
215
|
+
) do |version|
|
212
216
|
options.next_release_version = version
|
213
217
|
end
|
214
218
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'semverify'
|
4
4
|
require 'uri'
|
5
5
|
|
6
6
|
module CreateGithubRelease
|
@@ -193,7 +193,7 @@ module CreateGithubRelease
|
|
193
193
|
#
|
194
194
|
# The version of the next release
|
195
195
|
#
|
196
|
-
# @example By default, `next_release_version` is based on the value returned by `
|
196
|
+
# @example By default, `next_release_version` is based on the value returned by `semverify <release_type> --dry-run`
|
197
197
|
# options = CreateGithubRelease::CommandLineOptions.new(release_type: 'major')
|
198
198
|
# project = CreateGithubRelease::Project.new(options)
|
199
199
|
# project.next_release_version #=> '1.0.0'
|
@@ -206,12 +206,12 @@ module CreateGithubRelease
|
|
206
206
|
#
|
207
207
|
# @return [String]
|
208
208
|
#
|
209
|
-
# @raise [RuntimeError] if the
|
209
|
+
# @raise [RuntimeError] if the semverify command fails
|
210
210
|
#
|
211
211
|
# @api public
|
212
212
|
#
|
213
213
|
def next_release_version
|
214
|
-
@next_release_version ||= options.next_release_version ||
|
214
|
+
@next_release_version ||= options.next_release_version || next_version
|
215
215
|
end
|
216
216
|
|
217
217
|
# @!attribute [rw] last_release_tag
|
@@ -244,7 +244,7 @@ module CreateGithubRelease
|
|
244
244
|
#
|
245
245
|
# The version of the last release
|
246
246
|
#
|
247
|
-
# @example By default, `last_release_version` is based on the value returned by `
|
247
|
+
# @example By default, `last_release_version` is based on the value returned by `semverify current`
|
248
248
|
# options = CreateGithubRelease::CommandLineOptions.new(release_type: 'major')
|
249
249
|
# project = CreateGithubRelease::Project.new(options)
|
250
250
|
# project.last_release_version #=> '0.0.1'
|
@@ -257,12 +257,12 @@ module CreateGithubRelease
|
|
257
257
|
#
|
258
258
|
# @return [String]
|
259
259
|
#
|
260
|
-
# @raise [RuntimeError] if the
|
260
|
+
# @raise [RuntimeError] if the semverify command fails
|
261
261
|
#
|
262
262
|
# @api public
|
263
263
|
#
|
264
264
|
def last_release_version
|
265
|
-
@last_release_version ||= options.last_release_version ||
|
265
|
+
@last_release_version ||= options.last_release_version || current_version
|
266
266
|
end
|
267
267
|
|
268
268
|
# @!attribute [rw] release_branch
|
@@ -283,7 +283,7 @@ module CreateGithubRelease
|
|
283
283
|
#
|
284
284
|
# @return [String]
|
285
285
|
#
|
286
|
-
# @raise [RuntimeError] if the
|
286
|
+
# @raise [RuntimeError] if the semverify command fails
|
287
287
|
#
|
288
288
|
# @api public
|
289
289
|
#
|
@@ -311,7 +311,7 @@ module CreateGithubRelease
|
|
311
311
|
#
|
312
312
|
# @return [URI]
|
313
313
|
#
|
314
|
-
# @raise [RuntimeError] if the
|
314
|
+
# @raise [RuntimeError] if the semverify command fails
|
315
315
|
#
|
316
316
|
# @api public
|
317
317
|
#
|
@@ -327,7 +327,7 @@ module CreateGithubRelease
|
|
327
327
|
#
|
328
328
|
# The type of the release being created (e.g. 'major', 'minor', 'patch')
|
329
329
|
#
|
330
|
-
# @note this must be one of the values accepted by the `
|
330
|
+
# @note this must be one of the values accepted by the `semverify` command
|
331
331
|
#
|
332
332
|
# @example By default, this value comes from the options object
|
333
333
|
# options = CreateGithubRelease::CommandLineOptions.new(release_type: 'major')
|
@@ -367,7 +367,7 @@ module CreateGithubRelease
|
|
367
367
|
# project.release_url = URI.parse('https://github.com/org/repo/releases/tag/v1.0.0')
|
368
368
|
# project.release_url #=> #<URI::HTTPS https://github.com/org/repo/releases/tag/v1.0.0>
|
369
369
|
#
|
370
|
-
# @return [URI]
|
370
|
+
# @return [URI::Generic]
|
371
371
|
#
|
372
372
|
# @api public
|
373
373
|
#
|
@@ -419,7 +419,7 @@ module CreateGithubRelease
|
|
419
419
|
# project.remote_base_url = URI.parse('https://github.com/')
|
420
420
|
# project.remote_base_url #=> #<URI::HTTPS https://github.com/>
|
421
421
|
#
|
422
|
-
# @return [URI]
|
422
|
+
# @return [URI::Generic]
|
423
423
|
#
|
424
424
|
# @api public
|
425
425
|
#
|
@@ -812,31 +812,31 @@ module CreateGithubRelease
|
|
812
812
|
|
813
813
|
private
|
814
814
|
|
815
|
-
# The current version of the project as determined by
|
815
|
+
# The current version of the project as determined by semverify
|
816
816
|
# @return [String] The current version of the project
|
817
817
|
# @api private
|
818
|
-
def
|
819
|
-
output = `
|
820
|
-
raise 'Could not determine current version using
|
818
|
+
def current_version
|
819
|
+
output = `semverify current`
|
820
|
+
raise 'Could not determine current version using semverify' unless $CHILD_STATUS.success?
|
821
821
|
|
822
822
|
output.lines.last.chomp
|
823
823
|
end
|
824
824
|
|
825
|
-
# The next version of the project as determined by
|
825
|
+
# The next version of the project as determined by semverify and release_type
|
826
826
|
# @return [String] The next version of the project
|
827
827
|
# @api private
|
828
|
-
def
|
829
|
-
output = `
|
830
|
-
raise 'Could not determine next version using
|
828
|
+
def next_version
|
829
|
+
output = `semverify next-#{release_type} --dry-run`
|
830
|
+
raise 'Could not determine next version using semverify' unless $CHILD_STATUS.success?
|
831
831
|
|
832
832
|
output.lines.last.chomp
|
833
833
|
end
|
834
834
|
|
835
835
|
# Setup versions and tags for a first release
|
836
|
-
# @return [
|
836
|
+
# @return [void]
|
837
837
|
# @api private
|
838
838
|
def setup_first_release
|
839
|
-
self.next_release_version = @next_release_version ||
|
839
|
+
self.next_release_version = @next_release_version || current_version
|
840
840
|
self.last_release_version = ''
|
841
841
|
self.last_release_tag = ''
|
842
842
|
end
|
@@ -24,7 +24,7 @@ module CreateGithubRelease
|
|
24
24
|
# assertions = CreateGithubRelease::ReleaseAssertions.new(options)
|
25
25
|
# assertions.options # => #<CreateGithubRelease::Options:0x00007f9b0a0b0a00>
|
26
26
|
#
|
27
|
-
# @return [CreateGithubRelease::
|
27
|
+
# @return [CreateGithubRelease::CommandLineOptions]
|
28
28
|
attr_reader :options
|
29
29
|
|
30
30
|
# Create a new instance of ReleaseAssertions
|
@@ -79,6 +79,7 @@ module CreateGithubRelease
|
|
79
79
|
#
|
80
80
|
def make_assertions
|
81
81
|
ASSERTIONS.each do |assertion_class|
|
82
|
+
# @sg-ignore
|
82
83
|
assertion_class.new(options).assert
|
83
84
|
end
|
84
85
|
end
|
@@ -24,7 +24,7 @@ module CreateGithubRelease
|
|
24
24
|
# tasks = CreateGithubRelease::ReleaseTasks.new(options)
|
25
25
|
# tasks.options # => #<CreateGithubRelease::Options:0x00007f9b0a0b0a00>
|
26
26
|
#
|
27
|
-
# @return [CreateGithubRelease::
|
27
|
+
# @return [CreateGithubRelease::CommandLineOptions]
|
28
28
|
attr_reader :options
|
29
29
|
|
30
30
|
# Create a new instance of ReleaseTasks
|
@@ -71,6 +71,7 @@ module CreateGithubRelease
|
|
71
71
|
#
|
72
72
|
def run
|
73
73
|
TASKS.each do |task_class|
|
74
|
+
# @sg-ignore
|
74
75
|
task_class.new(options).run
|
75
76
|
end
|
76
77
|
end
|
@@ -5,12 +5,12 @@ require 'create_github_release/task_base'
|
|
5
5
|
|
6
6
|
module CreateGithubRelease
|
7
7
|
module Tasks
|
8
|
-
# Update the gem version using
|
8
|
+
# Update the gem version using semverify
|
9
9
|
#
|
10
10
|
# @api public
|
11
11
|
#
|
12
12
|
class UpdateVersion < TaskBase
|
13
|
-
# Update the gem version using
|
13
|
+
# Update the gem version using semverify
|
14
14
|
#
|
15
15
|
# @example
|
16
16
|
# require 'create_github_release'
|
@@ -33,35 +33,34 @@ module CreateGithubRelease
|
|
33
33
|
return if project.first_release?
|
34
34
|
|
35
35
|
print 'Updating version...'
|
36
|
-
|
36
|
+
increment_version
|
37
37
|
stage_version_file
|
38
38
|
end
|
39
39
|
|
40
40
|
private
|
41
41
|
|
42
|
-
#
|
42
|
+
# Increment the version using semverify
|
43
43
|
# @return [void]
|
44
44
|
# @api private
|
45
|
-
def
|
46
|
-
`
|
47
|
-
error 'Could not
|
45
|
+
def increment_version
|
46
|
+
`semverify next-#{project.release_type}`
|
47
|
+
error 'Could not increment version' unless $CHILD_STATUS.success?
|
48
48
|
end
|
49
49
|
|
50
|
-
# Return the path the the version file using
|
50
|
+
# Return the path the the version file using semverify
|
51
51
|
# @return [String]
|
52
52
|
# @api private
|
53
|
-
def
|
54
|
-
output = `
|
55
|
-
error '
|
53
|
+
def version_file
|
54
|
+
output = `semverify file`
|
55
|
+
error 'Semverify could determine the version file' unless $CHILD_STATUS.success?
|
56
56
|
|
57
57
|
output.lines.last.chomp
|
58
58
|
end
|
59
59
|
|
60
|
-
# Identify the version file using
|
60
|
+
# Identify the version file using semverify and stage the change to it
|
61
61
|
# @return [void]
|
62
62
|
# @api private
|
63
63
|
def stage_version_file
|
64
|
-
version_file = bump_version_file
|
65
64
|
`git add "#{version_file}"`
|
66
65
|
if $CHILD_STATUS.success?
|
67
66
|
puts 'OK'
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: create_github_release
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: semverify
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
20
|
-
type: :
|
19
|
+
version: '0.3'
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler-audit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: debug
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '1.36'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: ruby-debug-ide
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.7'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.7'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: simplecov
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +156,14 @@ dependencies:
|
|
128
156
|
requirements:
|
129
157
|
- - "~>"
|
130
158
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0.
|
159
|
+
version: '0.49'
|
132
160
|
type: :development
|
133
161
|
prerelease: false
|
134
162
|
version_requirements: !ruby/object:Gem::Requirement
|
135
163
|
requirements:
|
136
164
|
- - "~>"
|
137
165
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0.
|
166
|
+
version: '0.49'
|
139
167
|
- !ruby/object:Gem::Dependency
|
140
168
|
name: timecop
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,6 +219,8 @@ files:
|
|
191
219
|
- ".markdownlint.yml"
|
192
220
|
- ".rspec"
|
193
221
|
- ".rubocop.yml"
|
222
|
+
- ".solargraph.yml"
|
223
|
+
- ".vscode/launch.json"
|
194
224
|
- ".yardopts"
|
195
225
|
- CHANGELOG.md
|
196
226
|
- Gemfile
|
@@ -253,14 +283,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
253
283
|
requirements:
|
254
284
|
- - ">="
|
255
285
|
- !ruby/object:Gem::Version
|
256
|
-
version:
|
286
|
+
version: 3.0.0
|
257
287
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
258
288
|
requirements:
|
259
289
|
- - ">="
|
260
290
|
- !ruby/object:Gem::Version
|
261
291
|
version: '0'
|
262
292
|
requirements: []
|
263
|
-
rubygems_version: 3.4.
|
293
|
+
rubygems_version: 3.4.14
|
264
294
|
signing_key:
|
265
295
|
specification_version: 4
|
266
296
|
summary: A script to create a GitHub release for a Ruby Gem
|