create_github_release 1.3.3 → 1.3.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: aaae536c7d44e9ced42bb4598ebf91b3e803766c3a9b6283185fee4c7327c3db
4
- data.tar.gz: bbbb70f42b368e513d419b2c16490b8ef48d4f6269df342f5d23db6e3088927c
3
+ metadata.gz: b1b06e7f2c3125675b3b74014f25ed8a3b959d72b4c8f5c0f3740ea233362922
4
+ data.tar.gz: f49f1146fa4e77186582c17cd792a69a3ec6336b438d1a4bbda24d3e6c2bae0c
5
5
  SHA512:
6
- metadata.gz: c3b4a8e4380a61ade20ea5833f7016bed6c5e056b37e78fb2cc6f589fcdce575d0cdd998c1d920507a3b2e6bca16837f99a02724e8d88e01ef9f00e1c9d066ff
7
- data.tar.gz: df667078c1f6b9baccb7736a715343c8271dd3054ec42b96fa5bfb1115f955014a3f59f297e2d9cbdd15546dc787383e663c9eb0f756651e8ac812d5d4c35c32
6
+ metadata.gz: 41c3df4e14cf923a32a6cb8848c219a81ce01a0f4ea766457517028e700e7bdeaa57bbca229313b964c810cded33fe2a036da6c1cdf0bf2821a8dc27e831047f
7
+ data.tar.gz: f7c60f95cfda504347bb13da17938b39a2844df6092e722880bb5b62fe6ec6c50cfe19d500eb5bb5162fbfd25aece3fe13eb27876cb3ade24c6301f97c235ba6
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ 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.3.4 (2024-01-09)
9
+
10
+ [Full Changelog](https://github.com/main-branch/create_github_release/compare/v1.3.3..v1.3.4)
11
+
12
+ Changes since v1.3.3:
13
+
14
+ * 23a5db6 Document the revert-github-release script in the project README (#59)
15
+ * 0ed4549 Format the output so next steps are easier to read (#58)
16
+ * 5442745 Wait for some time between creating the release PR and searching for it (#56)
17
+
8
18
  ## v1.3.3 (2024-01-08)
9
19
 
10
20
  [Full Changelog](https://github.com/main-branch/create_github_release/compare/v1.3.2..v1.3.3)
data/README.md CHANGED
@@ -32,8 +32,8 @@ Tested on Ruby 3.0+
32
32
  * [Changing the pre-release type](#changing-the-pre-release-type)
33
33
  * [Creating the release after pre-releases](#creating-the-release-after-pre-releases)
34
34
  * [After Running create-github-release](#after-running-create-github-release)
35
+ * [Reverting `create-github-release`](#reverting-create-github-release)
35
36
  * [FAQ](#faq)
36
- * [What if I want to reverse the changes made by this script?](#what-if-i-want-to-reverse-the-changes-made-by-this-script)
37
37
  * [How is the changelog updated?](#how-is-the-changelog-updated)
38
38
  * [Development](#development)
39
39
  * [Contributing](#contributing)
@@ -320,33 +320,28 @@ Finally, publish your gem to rubygems.org with the command:
320
320
  rake release:rubygem_push
321
321
  ```
322
322
 
323
- ## FAQ
323
+ ### Reverting `create-github-release`
324
324
 
325
- ### What if I want to reverse the changes made by this script?
325
+ Should you decide that `create-github-release` was run in error, the `revert-github-release`
326
+ script is provided by this gem to revert the changes made.
326
327
 
327
- You will need to delete the Git tag and branch created by this script both remotely and locally.
328
+ This script must be run before the release PR is merged to the default branch.
328
329
 
329
- In your worktree run the following commands:
330
+ This script must be run in the root directory of the work tree with the release
331
+ branch checked out. This is the state that the `create-github-release` script leaves
332
+ you in.
330
333
 
331
- ```shell
332
- DEFAULT_BRANCH=main
333
- RELEASE_VERSION=1.0.1
334
- RELEASE_TAG="v${RELEASE_VERSION}"
335
- RELEASE_BRANCH="release_${RELEASE_TAG}"
336
- REMOTE=origin
337
-
338
- # Make sure the release branch is not checked out
339
- git checkout "${DEFAULT_BRANCH}"
340
-
341
- # Delete remote branch and tag
342
- # Deleting the remote branch will automatically close the release PR
343
- git push "${REMOTE}" --delete "${RELEASE_BRANCH}"
344
- git push "${REMOTE}" --delete "${RELEASE_TAG}"
345
-
346
- # Delete the local branch and tag
347
- git branch -D "${RELEASE_BRANCH}"
348
- git tag -d "${RELEASE_TAG}"
349
- ```
334
+ This script does the following:
335
+
336
+ * Adds a comment to the release PR noting that it will be reverted
337
+ * Switches the work tree to the default branch so the release branch can be deleted
338
+ * Deletes the local release branch and release tag
339
+ * Deletes the remote release branch and release tag
340
+ * Deletes the release object created in GitHub for this release
341
+
342
+ Deleting the release branch on the remote will automatically close the release PR.
343
+
344
+ ## FAQ
350
345
 
351
346
  ### How is the changelog updated?
352
347
 
@@ -3,6 +3,28 @@
3
3
 
4
4
  require 'create_github_release'
5
5
 
6
+ # Call method up to max_attempts times until it returns a non-nil value
7
+ #
8
+ # @param method [Proc] the method to call
9
+ # @param max_attempts [Integer] the maximum number of attempts to make
10
+ # @param sleep_time [Float] the number of seconds to sleep between attempts
11
+ #
12
+ # @return [Object] the result of the method call or nil
13
+ #
14
+ # @api public
15
+ #
16
+ def wait_for_non_nil(method, max_attempts: 10, sleep_time: 0.5)
17
+ result = nil
18
+
19
+ max_attempts.times do |n|
20
+ sleep sleep_time unless n.zero?
21
+
22
+ break if (result = method.call)
23
+ end
24
+
25
+ result
26
+ end
27
+
6
28
  options = CreateGithubRelease::CommandLine::Parser.new.parse(*ARGV)
7
29
  pp options if options.verbose
8
30
 
@@ -13,28 +35,29 @@ puts unless options.quiet
13
35
  CreateGithubRelease::ReleaseTasks.new(project).run
14
36
 
15
37
  puts <<~MESSAGE unless project.quiet
38
+
16
39
  SUCCESS: created release '#{project.next_release_tag}'
17
40
 
18
41
  Next steps:
19
42
 
20
43
  * Review the release notes:
21
44
 
22
- #{project.release_url}
45
+ #{project.release_url}
23
46
 
24
47
  * Get someone to review and approve the release pull request:
25
48
 
26
- #{project.release_pr_url}
49
+ #{wait_for_non_nil(-> { project.release_pr_url }, max_attempts: 10, sleep_time: 0.5)}
27
50
 
28
51
  * Merge the pull request manually from the command line with the following
29
52
  commands:
30
53
 
31
- git checkout #{project.default_branch}
32
- git merge --ff-only #{project.release_branch}
33
- git push
54
+ git checkout #{project.default_branch}
55
+ git merge --ff-only #{project.release_branch}
56
+ git push
34
57
 
35
58
  * Wait for the CI build to pass on the default branch and then release the
36
59
  gem with the following command:
37
60
 
38
- rake release:rubygem_push
61
+ rake release:rubygem_push
39
62
 
40
63
  MESSAGE
@@ -2,5 +2,5 @@
2
2
 
3
3
  module CreateGithubRelease
4
4
  # The version of this gem
5
- VERSION = '1.3.3'
5
+ VERSION = '1.3.4'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: create_github_release
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James
@@ -250,8 +250,8 @@ metadata:
250
250
  allowed_push_host: https://rubygems.org
251
251
  homepage_uri: https://github.com/main-branch/create_github_release
252
252
  source_code_uri: https://github.com/main-branch/create_github_release
253
- changelog_uri: https://rubydoc.info/gems/create_github_release/1.3.3/file/CHANGELOG.md
254
- documentation_uri: https://rubydoc.info/gems/create_github_release/1.3.3
253
+ changelog_uri: https://rubydoc.info/gems/create_github_release/1.3.4/file/CHANGELOG.md
254
+ documentation_uri: https://rubydoc.info/gems/create_github_release/1.3.4
255
255
  rubygems_mfa_required: 'true'
256
256
  post_install_message:
257
257
  rdoc_options: []