create_github_release 0.2.1 → 0.3.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/CHANGELOG.md +12 -0
- data/LICENSE.txt +1 -1
- data/README.md +36 -21
- data/create_github_release.gemspec +1 -0
- data/exe/create-github-release +12 -8
- data/lib/create_github_release/assertion_base.rb +25 -11
- data/lib/create_github_release/assertions/bundle_is_up_to_date.rb +4 -3
- data/lib/create_github_release/assertions/{docker_is_running.rb → gh_authenticated.rb} +9 -8
- data/lib/create_github_release/assertions/gh_command_exists.rb +3 -2
- data/lib/create_github_release/assertions/git_command_exists.rb +3 -2
- data/lib/create_github_release/assertions/in_git_repo.rb +3 -2
- data/lib/create_github_release/assertions/in_repo_root_directory.rb +3 -2
- data/lib/create_github_release/assertions/last_release_tag_exists.rb +45 -0
- data/lib/create_github_release/assertions/local_and_remote_on_same_commit.rb +4 -3
- data/lib/create_github_release/assertions/local_release_branch_does_not_exist.rb +6 -5
- data/lib/create_github_release/assertions/local_release_tag_does_not_exist.rb +3 -3
- data/lib/create_github_release/assertions/no_staged_changes.rb +3 -2
- data/lib/create_github_release/assertions/no_uncommitted_changes.rb +3 -2
- data/lib/create_github_release/assertions/on_default_branch.rb +5 -4
- data/lib/create_github_release/assertions/remote_release_branch_does_not_exist.rb +6 -5
- data/lib/create_github_release/assertions/remote_release_tag_does_not_exist.rb +6 -5
- data/lib/create_github_release/assertions.rb +2 -2
- data/lib/create_github_release/backtick_debug.rb +69 -0
- data/lib/create_github_release/change.rb +73 -0
- data/lib/create_github_release/changelog.rb +40 -68
- data/lib/create_github_release/command_line_options.rb +367 -0
- data/lib/create_github_release/command_line_parser.rb +113 -25
- data/lib/create_github_release/project.rb +787 -0
- data/lib/create_github_release/release_assertions.rb +3 -3
- data/lib/create_github_release/release_tasks.rb +1 -1
- data/lib/create_github_release/task_base.rb +25 -11
- data/lib/create_github_release/tasks/commit_release.rb +4 -3
- data/lib/create_github_release/tasks/create_github_release.rb +16 -35
- data/lib/create_github_release/tasks/create_release_branch.rb +6 -5
- data/lib/create_github_release/tasks/create_release_pull_request.rb +10 -42
- data/lib/create_github_release/tasks/create_release_tag.rb +6 -5
- data/lib/create_github_release/tasks/push_release.rb +5 -4
- data/lib/create_github_release/tasks/update_changelog.rb +16 -67
- data/lib/create_github_release/tasks/update_version.rb +4 -3
- data/lib/create_github_release/version.rb +1 -1
- data/lib/create_github_release.rb +4 -2
- metadata +23 -8
- data/.vscode/settings.json +0 -7
- data/lib/create_github_release/assertions/changelog_docker_container_exists.rb +0 -73
- data/lib/create_github_release/options.rb +0 -397
- data/lib/create_github_release/release.rb +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6346efaa6cdc82095a7e3220d74dd359a10843f24f81c50037d9c85dbdc9dd8
|
4
|
+
data.tar.gz: 674903481a785730fde4910bd0994f0cbcbed3196e3355e37775058bc1b0215d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bad25c4943faf700f6cb8593e42a5d2b2f879ec9e6f65fdcab120568e0fc4563b8e4972e76a595c8e2bfaabacba8ee5da98a9ab919bbc763a4aafdc889ba8588
|
7
|
+
data.tar.gz: 61b4028671f28e714cb88cfade742d515f45d7dba45a158865e2d94ea1ec3e609038ae95446274d018839f162a0743f5ae34f954ae1550016ad99b7afa6d07cf
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,18 @@ 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
|
+
## v0.3.0 (2023-01-29)
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/main-branch/create_github_release/compare/v0.2.1..v0.3.0)
|
11
|
+
|
12
|
+
Changes since v0.2.1:
|
13
|
+
|
14
|
+
* 92ce55a Report "no changes" in the release description (#30)
|
15
|
+
* 1b3505b Assert that gh has been authenticated (#29)
|
16
|
+
* c7bd12d Complete redesign of this gem (#28)
|
17
|
+
* d75e1e9 Create release tag after committing release changes (#27)
|
18
|
+
* 24bdd02 Release v0.2.1
|
19
|
+
|
8
20
|
## v0.2.1 (2022-11-16)
|
9
21
|
|
10
22
|
[Full Changelog](https://github.com/main-branch/create_github_release/compare/v0.2.0...v0.2.1)
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -7,11 +7,40 @@
|
|
7
7
|
|
8
8
|
Create a GitHub release for a new gem version.
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
The `create-github-release` script does the following:
|
11
|
+
|
12
|
+
* Bumps the project's version
|
13
|
+
* Updates the project's changelog
|
14
|
+
* Creates a release branch
|
15
|
+
* Commits the version change and changelog update
|
16
|
+
* Creates a version tag
|
17
|
+
* Pushes the release branch to GitHub
|
18
|
+
* Creates a GitHub release and GitHub pull request for the release
|
19
|
+
|
20
|
+
You should merge the pull request once it is reviewed and approved.
|
21
|
+
|
22
|
+
Pull the changes from the default branch and publish your gem with the `rake release` command.
|
23
|
+
|
24
|
+
Here is the command line --help output:
|
25
|
+
|
26
|
+
```text
|
27
|
+
Usage:
|
28
|
+
create-github-release --help | RELEASE_TYPE [options]
|
29
|
+
|
30
|
+
RELEASE_TYPE must be 'major', 'minor', or 'patch'
|
31
|
+
|
32
|
+
Options:
|
33
|
+
--default-branch=BRANCH_NAME Override the default branch
|
34
|
+
--release-branch=BRANCH_NAME Override the release branch to create
|
35
|
+
--remote=REMOTE_NAME Use this remote name instead of 'origin'
|
36
|
+
--last-release-version=VERSION
|
37
|
+
Use this version instead `bump current`
|
38
|
+
--next-release-version=VERSION
|
39
|
+
Use this version instead `bump RELEASE_TYPE`
|
40
|
+
--changelog-path=PATH Use this file instead of CHANGELOG.md
|
41
|
+
-q, --[no-]quiet Do not show output
|
42
|
+
-v, --[no-]verbose Show extra output
|
43
|
+
-h, --help Show this message
|
15
44
|
```
|
16
45
|
|
17
46
|
The following conditions must be met in order to create a release:
|
@@ -21,21 +50,11 @@ The following conditions must be met in order to create a release:
|
|
21
50
|
* The default branch must be checked out
|
22
51
|
* There are no uncommitted changes
|
23
52
|
* The local and remote must be on the same commit
|
53
|
+
* The last release tag must exist
|
24
54
|
* The new release tag must not already exist either locally or remotely
|
25
55
|
* The new release branch must not already exist either locally or remotely
|
26
|
-
* Docker must be running
|
27
|
-
* The changelog docker container must already exist or be able to be built
|
28
56
|
* The gh command must be installed
|
29
57
|
|
30
|
-
The result of running this command is:
|
31
|
-
* A new release branch is created
|
32
|
-
* CHANGELOG.md is updated with a list of PRs since the last release
|
33
|
-
* The Gem version is updated via Bump
|
34
|
-
* The CHANGELOG.md and version changes are committed and tagged on the new release branch
|
35
|
-
* The new release branch is pushed to the remote
|
36
|
-
* A release is created on GitHub
|
37
|
-
* A release PR is created on GitHub
|
38
|
-
|
39
58
|
## Installation
|
40
59
|
|
41
60
|
Add `create_github_release` as a development dependency in your project's gemspec:
|
@@ -52,11 +71,7 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
52
71
|
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
53
72
|
prompt that will allow you to experiment.
|
54
73
|
|
55
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
56
|
-
release a new version, update the version number in `version.rb`, and then run
|
57
|
-
`bundle exec rake release`, which will create a git tag for the version, push git
|
58
|
-
commits and the created tag, and push the `.gem` file to
|
59
|
-
[rubygems.org](https://rubygems.org).
|
74
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
60
75
|
|
61
76
|
## Contributing
|
62
77
|
|
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_development_dependency 'simplecov', '~> 0.21'
|
41
41
|
spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
|
42
42
|
spec.add_development_dependency 'solargraph', '~> 0.47'
|
43
|
+
spec.add_development_dependency 'timecop', '~> 0.9'
|
43
44
|
spec.add_development_dependency 'yard', '~> 0.9'
|
44
45
|
spec.add_development_dependency 'yardstick', '~> 0.9'
|
45
46
|
|
data/exe/create-github-release
CHANGED
@@ -3,20 +3,24 @@
|
|
3
3
|
|
4
4
|
require 'create_github_release'
|
5
5
|
|
6
|
-
options = CreateGithubRelease::CommandLineParser.new.parse(ARGV)
|
7
|
-
|
6
|
+
options = CreateGithubRelease::CommandLineParser.new.parse(*ARGV)
|
7
|
+
pp options if options.verbose
|
8
|
+
|
9
|
+
project = CreateGithubRelease::Project.new(options)
|
10
|
+
|
11
|
+
CreateGithubRelease::ReleaseAssertions.new(project).make_assertions
|
8
12
|
puts unless options.quiet
|
9
|
-
CreateGithubRelease::ReleaseTasks.new(
|
13
|
+
CreateGithubRelease::ReleaseTasks.new(project).run
|
10
14
|
|
11
|
-
puts <<~MESSAGE unless
|
12
|
-
Release '#{
|
13
|
-
See the release notes at #{
|
15
|
+
puts <<~MESSAGE unless project.quiet
|
16
|
+
Release '#{project.next_release_tag}' created successfully
|
17
|
+
See the release notes at #{project.release_url}
|
14
18
|
|
15
19
|
Next steps:
|
16
20
|
* Get someone to review and approve the release pull request
|
17
21
|
* Merge the pull request manually from the command line with the following commands:
|
18
22
|
|
19
|
-
git checkout #{
|
20
|
-
git merge --ff-only #{
|
23
|
+
git checkout #{project.default_branch}
|
24
|
+
git merge --ff-only #{project.release_branch}
|
21
25
|
git push
|
22
26
|
MESSAGE
|
@@ -9,11 +9,14 @@ module CreateGithubRelease
|
|
9
9
|
# @api private
|
10
10
|
#
|
11
11
|
class AssertionBase
|
12
|
-
# Create a new assertion object and save the given `
|
13
|
-
# @param
|
12
|
+
# Create a new assertion object and save the given `project`
|
13
|
+
# @param project [CreateGithubRelease::Project] the project to create a release for
|
14
14
|
# @api private
|
15
|
-
def initialize(
|
16
|
-
|
15
|
+
def initialize(project)
|
16
|
+
raise ArgumentError, 'project must be a CreateGithubRelease::Project' unless
|
17
|
+
project.is_a?(CreateGithubRelease::Project)
|
18
|
+
|
19
|
+
@project = project
|
17
20
|
end
|
18
21
|
|
19
22
|
# This method must be overriden by a subclass
|
@@ -29,25 +32,25 @@ module CreateGithubRelease
|
|
29
32
|
|
30
33
|
# @!attribute [r] options
|
31
34
|
#
|
32
|
-
# The
|
33
|
-
# @return [CreateGithubRelease::
|
35
|
+
# The project passed to the assertion object
|
36
|
+
# @return [CreateGithubRelease::Project] the project to create a release for
|
34
37
|
# @api private
|
35
|
-
attr_reader :
|
38
|
+
attr_reader :project
|
36
39
|
|
37
|
-
# Calls `Kernel.print` if the `quiet` flag is not set in the `
|
40
|
+
# Calls `Kernel.print` if the `quiet` flag is not set in the `project`
|
38
41
|
# @param args [Array] the arguments to pass to `Kernel.print`
|
39
42
|
# @return [void]
|
40
43
|
# @api private
|
41
44
|
def print(*args)
|
42
|
-
super unless
|
45
|
+
super unless project.quiet?
|
43
46
|
end
|
44
47
|
|
45
|
-
# Calls `Kernel.puts` if the `quiet` flag is not set in the `
|
48
|
+
# Calls `Kernel.puts` if the `quiet` flag is not set in the `project`
|
46
49
|
# @param args [Array] the arguments to pass to `Kernel.puts`
|
47
50
|
# @return [void]
|
48
51
|
# @api private
|
49
52
|
def puts(*args)
|
50
|
-
super unless
|
53
|
+
super unless project.quiet?
|
51
54
|
end
|
52
55
|
|
53
56
|
# Writes a message to stderr and exits with exitcode 1
|
@@ -58,5 +61,16 @@ module CreateGithubRelease
|
|
58
61
|
warn "ERROR: #{message}"
|
59
62
|
exit 1
|
60
63
|
end
|
64
|
+
|
65
|
+
# `true` if the `project.verbose?` flag is `true`
|
66
|
+
# @return [Boolean]
|
67
|
+
# @api private
|
68
|
+
def backtick_debug?
|
69
|
+
project.verbose?
|
70
|
+
end
|
71
|
+
|
72
|
+
# This overrides the backtick operator for this class to output debug
|
73
|
+
# information if `verbose?` is true
|
74
|
+
include CreateGithubRelease::BacktickDebug
|
61
75
|
end
|
62
76
|
end
|
@@ -5,7 +5,7 @@ require 'create_github_release/assertion_base'
|
|
5
5
|
|
6
6
|
module CreateGithubRelease
|
7
7
|
module Assertions
|
8
|
-
# Assert that
|
8
|
+
# Assert that project.release+branch does not exist
|
9
9
|
#
|
10
10
|
# Checks both the local repository and the remote repository.
|
11
11
|
#
|
@@ -17,8 +17,9 @@ module CreateGithubRelease
|
|
17
17
|
# @example
|
18
18
|
# require 'create_github_release'
|
19
19
|
#
|
20
|
-
# options = CreateGithubRelease::
|
21
|
-
#
|
20
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
21
|
+
# project = CreateGithubRelease::Project.new(options)
|
22
|
+
# assertion = CreateGithubRelease::Assertions::BundleIsUpToDate.new(project)
|
22
23
|
# begin
|
23
24
|
# assertion.assert
|
24
25
|
# puts 'Assertion passed'
|
@@ -5,18 +5,19 @@ require 'create_github_release/assertion_base'
|
|
5
5
|
|
6
6
|
module CreateGithubRelease
|
7
7
|
module Assertions
|
8
|
-
# Assert that
|
8
|
+
# Assert that the 'gh' command is in the path
|
9
9
|
#
|
10
10
|
# @api public
|
11
11
|
#
|
12
|
-
class
|
13
|
-
# Make sure that
|
12
|
+
class GhAuthenticated < AssertionBase
|
13
|
+
# Make sure that the 'gh' command is authenticated
|
14
14
|
#
|
15
15
|
# @example
|
16
16
|
# require 'create_github_release'
|
17
17
|
#
|
18
|
-
# options = CreateGithubRelease::
|
19
|
-
#
|
18
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
19
|
+
# project = CreateGithubRelease::Project.new(options)
|
20
|
+
# assertion = CreateGithubRelease::Assertions::GhAuthenticated.new(project)
|
20
21
|
# begin
|
21
22
|
# assertion.assert
|
22
23
|
# puts 'Assertion passed'
|
@@ -29,12 +30,12 @@ module CreateGithubRelease
|
|
29
30
|
# @raise [SystemExit] if the assertion fails
|
30
31
|
#
|
31
32
|
def assert
|
32
|
-
print 'Checking that
|
33
|
-
`
|
33
|
+
print 'Checking that the gh command is authenticated...'
|
34
|
+
output = `gh auth status 2>&1`
|
34
35
|
if $CHILD_STATUS.success?
|
35
36
|
puts 'OK'
|
36
37
|
else
|
37
|
-
error
|
38
|
+
error "gh not authenticated:\n#{output}"
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
@@ -15,8 +15,9 @@ module CreateGithubRelease
|
|
15
15
|
# @example
|
16
16
|
# require 'create_github_release'
|
17
17
|
#
|
18
|
-
# options = CreateGithubRelease::
|
19
|
-
#
|
18
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
19
|
+
# project = CreateGithubRelease::Project.new(options)
|
20
|
+
# assertion = CreateGithubRelease::Assertions::GhCommandExists.new(project)
|
20
21
|
# begin
|
21
22
|
# assertion.assert
|
22
23
|
# puts 'Assertion passed'
|
@@ -15,8 +15,9 @@ module CreateGithubRelease
|
|
15
15
|
# @example
|
16
16
|
# require 'create_github_release'
|
17
17
|
#
|
18
|
-
# options = CreateGithubRelease::
|
19
|
-
#
|
18
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
19
|
+
# project = CreateGithubRelease::Project.new(options)
|
20
|
+
# assertion = CreateGithubRelease::Assertions::GitCommandExists.new(project)
|
20
21
|
# begin
|
21
22
|
# assertion.assert
|
22
23
|
# puts 'Assertion passed'
|
@@ -17,8 +17,9 @@ module CreateGithubRelease
|
|
17
17
|
# @example
|
18
18
|
# require 'create_github_release'
|
19
19
|
#
|
20
|
-
# options = CreateGithubRelease::
|
21
|
-
#
|
20
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
21
|
+
# project = CreateGithubRelease::Project.new(options)
|
22
|
+
# assertion = CreateGithubRelease::Assertions::InGitRepo.new(project)
|
22
23
|
# begin
|
23
24
|
# assertion.assert
|
24
25
|
# puts 'Assertion passed'
|
@@ -18,8 +18,9 @@ module CreateGithubRelease
|
|
18
18
|
# @example
|
19
19
|
# require 'create_github_release'
|
20
20
|
#
|
21
|
-
# options = CreateGithubRelease::
|
22
|
-
#
|
21
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
22
|
+
# project = CreateGithubRelease::Project.new(options)
|
23
|
+
# assertion = CreateGithubRelease::Assertions::InRepoRootDirectory.new(project)
|
23
24
|
# begin
|
24
25
|
# assertion.assert
|
25
26
|
# puts 'Assertion passed'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'English'
|
4
|
+
require 'create_github_release/assertion_base'
|
5
|
+
|
6
|
+
module CreateGithubRelease
|
7
|
+
module Assertions
|
8
|
+
# Assert that the release tag does not exist in the local repository
|
9
|
+
#
|
10
|
+
# @api public
|
11
|
+
#
|
12
|
+
class LastReleaseTagExists < AssertionBase
|
13
|
+
# Assert that the last release tag exists in the local repository
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# require 'create_github_release'
|
17
|
+
#
|
18
|
+
# options = CreateGithubRelease::Options.new { |o| o.release_type = 'major' }
|
19
|
+
# assertion = CreateGithubRelease::Assertions::LastReleaseTagExists.new(options)
|
20
|
+
# begin
|
21
|
+
# assertion.assert
|
22
|
+
# puts 'Assertion passed'
|
23
|
+
# rescue SystemExit
|
24
|
+
# puts 'Assertion failed'
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# @return [void]
|
28
|
+
#
|
29
|
+
# @raise [SystemExit] if the assertion fails
|
30
|
+
#
|
31
|
+
def assert
|
32
|
+
print "Checking that last release tag '#{project.last_release_tag}' exists..."
|
33
|
+
|
34
|
+
tags = `git tag --list "#{project.last_release_tag}"`.chomp
|
35
|
+
error 'Could not list tags' unless $CHILD_STATUS.success?
|
36
|
+
|
37
|
+
if tags == ''
|
38
|
+
error "Last release tag '#{project.last_release_tag}' does not exist"
|
39
|
+
else
|
40
|
+
puts 'OK'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -17,8 +17,9 @@ module CreateGithubRelease
|
|
17
17
|
# @example
|
18
18
|
# require 'create_github_release'
|
19
19
|
#
|
20
|
-
# options = CreateGithubRelease::
|
21
|
-
#
|
20
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
21
|
+
# project = CreateGithubRelease::Project.new(options)
|
22
|
+
# assertion = CreateGithubRelease::Assertions::LocalAndRemoteOnSameCommit.new(project)
|
22
23
|
# begin
|
23
24
|
# assertion.assert
|
24
25
|
# puts 'Assertion passed'
|
@@ -33,7 +34,7 @@ module CreateGithubRelease
|
|
33
34
|
def assert
|
34
35
|
print 'Checking that local and remote are on the same commit...'
|
35
36
|
local_commit = `git rev-parse HEAD`.chomp
|
36
|
-
remote_commit = `git ls-remote '#{
|
37
|
+
remote_commit = `git ls-remote '#{project.remote}' '#{project.default_branch}' | cut -f 1`.chomp
|
37
38
|
if local_commit == remote_commit
|
38
39
|
puts 'OK'
|
39
40
|
else
|
@@ -15,8 +15,9 @@ module CreateGithubRelease
|
|
15
15
|
# @example
|
16
16
|
# require 'create_github_release'
|
17
17
|
#
|
18
|
-
# options = CreateGithubRelease::
|
19
|
-
#
|
18
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
19
|
+
# project = CreateGithubRelease::Project.new(options)
|
20
|
+
# assertion = CreateGithubRelease::Assertions::LocalReleaseBranchDoesNotExist.new(project)
|
20
21
|
# begin
|
21
22
|
# assertion.assert
|
22
23
|
# puts 'Assertion passed'
|
@@ -29,15 +30,15 @@ module CreateGithubRelease
|
|
29
30
|
# @raise [SystemExit] if the assertion fails
|
30
31
|
#
|
31
32
|
def assert
|
32
|
-
print "Checking that local branch ' #{
|
33
|
+
print "Checking that local branch ' #{project.release_branch}' does not exist..."
|
33
34
|
|
34
|
-
branches = `git branch --list "#{
|
35
|
+
branches = `git branch --list "#{project.release_branch}"`.chomp
|
35
36
|
error 'Could not list branches' unless $CHILD_STATUS.success?
|
36
37
|
|
37
38
|
if branches == ''
|
38
39
|
puts 'OK'
|
39
40
|
else
|
40
|
-
error "Local branch '#{
|
41
|
+
error "Local branch '#{project.release_branch}' already exists"
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
@@ -29,15 +29,15 @@ module CreateGithubRelease
|
|
29
29
|
# @raise [SystemExit] if the assertion fails
|
30
30
|
#
|
31
31
|
def assert
|
32
|
-
print "Checking that local tag '#{
|
32
|
+
print "Checking that local tag '#{project.next_release_tag}' does not exist..."
|
33
33
|
|
34
|
-
tags = `git tag --list "#{
|
34
|
+
tags = `git tag --list "#{project.next_release_tag}"`.chomp
|
35
35
|
error 'Could not list tags' unless $CHILD_STATUS.success?
|
36
36
|
|
37
37
|
if tags == ''
|
38
38
|
puts 'OK'
|
39
39
|
else
|
40
|
-
error "Local tag '#{
|
40
|
+
error "Local tag '#{project.next_release_tag}' already exists"
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -17,8 +17,9 @@ module CreateGithubRelease
|
|
17
17
|
# @example
|
18
18
|
# require 'create_github_release'
|
19
19
|
#
|
20
|
-
# options = CreateGithubRelease::
|
21
|
-
#
|
20
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
21
|
+
# project = CreateGithubRelease::Project.new(options)
|
22
|
+
# assertion = CreateGithubRelease::Assertions::NoStagedChanges.new(project)
|
22
23
|
# begin
|
23
24
|
# assertion.assert
|
24
25
|
# puts 'Assertion passed'
|
@@ -17,8 +17,9 @@ module CreateGithubRelease
|
|
17
17
|
# @example
|
18
18
|
# require 'create_github_release'
|
19
19
|
#
|
20
|
-
# options = CreateGithubRelease::
|
21
|
-
#
|
20
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
21
|
+
# project = CreateGithubRelease::Project.new(options)
|
22
|
+
# assertion = CreateGithubRelease::Assertions::NoUncommittedChanges.new(project)
|
22
23
|
# begin
|
23
24
|
# assertion.assert
|
24
25
|
# puts 'Assertion passed'
|
@@ -17,8 +17,9 @@ module CreateGithubRelease
|
|
17
17
|
# @example
|
18
18
|
# require 'create_github_release'
|
19
19
|
#
|
20
|
-
# options = CreateGithubRelease::
|
21
|
-
#
|
20
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
21
|
+
# project = CreateGithubRelease::Project.new(options)
|
22
|
+
# assertion = CreateGithubRelease::Assertions::OnDefaultBranch.new(project)
|
22
23
|
# begin
|
23
24
|
# assertion.assert
|
24
25
|
# puts 'Assertion passed'
|
@@ -33,10 +34,10 @@ module CreateGithubRelease
|
|
33
34
|
def assert
|
34
35
|
print 'Checking that you are on the default branch...'
|
35
36
|
current_branch = `git branch --show-current`.chomp
|
36
|
-
if current_branch ==
|
37
|
+
if current_branch == project.default_branch
|
37
38
|
puts 'OK'
|
38
39
|
else
|
39
|
-
error "You are not on the default branch '#{
|
40
|
+
error "You are not on the default branch '#{project.default_branch}'"
|
40
41
|
end
|
41
42
|
end
|
42
43
|
end
|
@@ -15,8 +15,9 @@ module CreateGithubRelease
|
|
15
15
|
# @example
|
16
16
|
# require 'create_github_release'
|
17
17
|
#
|
18
|
-
# options = CreateGithubRelease::
|
19
|
-
#
|
18
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
19
|
+
# project = CreateGithubRelease::Project.new(options)
|
20
|
+
# assertion = CreateGithubRelease::Assertions::RemoteReleaseBranchDoesNotExist.new(project)
|
20
21
|
# begin
|
21
22
|
# assertion.assert
|
22
23
|
# puts 'Assertion passed'
|
@@ -29,13 +30,13 @@ module CreateGithubRelease
|
|
29
30
|
# @raise [SystemExit] if the assertion fails
|
30
31
|
#
|
31
32
|
def assert
|
32
|
-
print "Checking that the remote branch '#{
|
33
|
-
`git ls-remote --heads --exit-code '#{
|
33
|
+
print "Checking that the remote branch '#{project.release_branch}' does not exist..."
|
34
|
+
`git ls-remote --heads --exit-code '#{project.remote}' '#{project.release_branch}' >/dev/null 2>&1`
|
34
35
|
if $CHILD_STATUS.exitstatus == 2
|
35
36
|
puts 'OK'
|
36
37
|
else
|
37
38
|
error 'Could not list branches' unless $CHILD_STATUS.success?
|
38
|
-
error "'#{
|
39
|
+
error "'#{project.release_branch}' already exists"
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
@@ -15,8 +15,9 @@ module CreateGithubRelease
|
|
15
15
|
# @example
|
16
16
|
# require 'create_github_release'
|
17
17
|
#
|
18
|
-
# options = CreateGithubRelease::
|
19
|
-
#
|
18
|
+
# options = CreateGithubRelease::CommandLineOptions.new { |o| o.release_type = 'major' }
|
19
|
+
# project = CreateGithubRelease::Project.new(options)
|
20
|
+
# assertion = CreateGithubRelease::Assertions::RemoteReleaseTagDoesNotExist.new(project)
|
20
21
|
# begin
|
21
22
|
# assertion.assert
|
22
23
|
# puts 'Assertion passed'
|
@@ -29,13 +30,13 @@ module CreateGithubRelease
|
|
29
30
|
# @raise [SystemExit] if the assertion fails
|
30
31
|
#
|
31
32
|
def assert
|
32
|
-
print "Checking that the remote tag '#{
|
33
|
-
`git ls-remote --tags --exit-code '#{
|
33
|
+
print "Checking that the remote tag '#{project.next_release_tag}' does not exist..."
|
34
|
+
`git ls-remote --tags --exit-code '#{project.remote}' #{project.next_release_tag} >/dev/null 2>&1`
|
34
35
|
if $CHILD_STATUS.exitstatus == 2
|
35
36
|
puts 'OK'
|
36
37
|
else
|
37
38
|
error 'Could not list tags' unless $CHILD_STATUS.success?
|
38
|
-
error "Remote tag '#{
|
39
|
+
error "Remote tag '#{project.next_release_tag}' already exists"
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
@@ -9,12 +9,12 @@ module CreateGithubRelease
|
|
9
9
|
end
|
10
10
|
|
11
11
|
require_relative 'assertions/bundle_is_up_to_date'
|
12
|
-
require_relative 'assertions/
|
13
|
-
require_relative 'assertions/docker_is_running'
|
12
|
+
require_relative 'assertions/gh_authenticated'
|
14
13
|
require_relative 'assertions/gh_command_exists'
|
15
14
|
require_relative 'assertions/git_command_exists'
|
16
15
|
require_relative 'assertions/in_git_repo'
|
17
16
|
require_relative 'assertions/in_repo_root_directory'
|
17
|
+
require_relative 'assertions/last_release_tag_exists'
|
18
18
|
require_relative 'assertions/local_and_remote_on_same_commit'
|
19
19
|
require_relative 'assertions/local_release_branch_does_not_exist'
|
20
20
|
require_relative 'assertions/local_release_tag_does_not_exist'
|