Class: Moonshot::BuildMechanism::GithubRelease
- Inherits:
-
Object
- Object
- Moonshot::BuildMechanism::GithubRelease
show all
- Extended by:
- Forwardable
- Includes:
- DoctorHelper, ResourcesHelper, Shell
- Defined in:
- lib/moonshot/build_mechanism/github_release.rb
Overview
A build mechanism that creates a tag and GitHub release.
Constant Summary
Constants included
from Shell
Shell::CommandError, Shell::DEFAULT_RETRY_OPTIONS
Instance Attribute Summary
#resources
Instance Method Summary
collapse
Methods included from Shell
sh_out, #sh_retry, #sh_step, #shell
Constructor Details
#initialize(build_mechanism, ci_status_timeout: 600, max_tag_find_timeout: 240, skip_ci_status: false) ⇒ GithubRelease
Returns a new instance of GithubRelease.
22
23
24
25
26
27
28
29
30
|
# File 'lib/moonshot/build_mechanism/github_release.rb', line 22
def initialize(build_mechanism,
ci_status_timeout: 600,
max_tag_find_timeout: 240,
skip_ci_status: false)
@build_mechanism = build_mechanism
@ci_status_timeout = ci_status_timeout
@max_tag_find_timeout = max_tag_find_timeout
@skip_ci_status = skip_ci_status
end
|
Instance Method Details
#build_cli_hook(parser) ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/moonshot/build_mechanism/github_release.rb', line 32
def build_cli_hook(parser)
parser.on('-s', '--[no-]skip-ci-status', 'Skips checks on CI jobs', TrueClass) do |value|
@skip_ci_status = value
end
parser
end
|
#build_hook(version) ⇒ Object
61
62
63
64
65
66
67
68
|
# File 'lib/moonshot/build_mechanism/github_release.rb', line 61
def build_hook(version)
assert_state(version)
git_tag(version, @sha, @changes)
git_push_tag('upstream', version)
hub_create_release(@semver, @sha, @changes)
ilog.msg("#{releases_url}/tag/#{version}")
@build_mechanism.build_hook(version)
end
|
#doctor_hook ⇒ Object
40
41
42
43
|
# File 'lib/moonshot/build_mechanism/github_release.rb', line 40
def doctor_hook
super
@build_mechanism.doctor_hook
end
|
#post_build_hook(version) ⇒ Object
70
71
72
73
|
# File 'lib/moonshot/build_mechanism/github_release.rb', line 70
def post_build_hook(version)
assert_state(version)
@build_mechanism.post_build_hook(version)
end
|
#pre_build_hook(version) ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/moonshot/build_mechanism/github_release.rb', line 50
def pre_build_hook(version)
@semver = ::Semantic::Version.new(version)
@target_version = [@semver.major, @semver.minor, @semver.patch].join('.')
sh_step('git fetch --tags upstream')
@sha = `git rev-parse HEAD`.chomp
validate_commit
@changes = validate_changelog(@target_version)
confirm_or_fail(@semver)
@build_mechanism.pre_build_hook(version)
end
|
#resources=(r) ⇒ Object
45
46
47
48
|
# File 'lib/moonshot/build_mechanism/github_release.rb', line 45
def resources=(r)
super
@build_mechanism.resources = r
end
|