bake-releases 0.5.4 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4bb4cfc2c04ad0dc789ffb2319691472b4e2a1b068c3fc92236eeafd27710e7c
4
- data.tar.gz: c622cf32ecd07991035ed13a8d85678abe718c875f5890c9179f1e7170b27738
3
+ metadata.gz: d70acb13cdf265f825f2f48727a0a588fa84bbbe2b20ad66515912ea2f808569
4
+ data.tar.gz: 66e5d779098dc41c1155977e5737420093e16ba39f53fd294a310767e213272c
5
5
  SHA512:
6
- metadata.gz: e28a151c62a7a2b147f243f68ed257f91bb987183b3f3d0ccc884ae0d0b2d9e059f57073c01af8c31c2a9fbfd006003ab6338abcbff5a407f80805fbe9e124d7
7
- data.tar.gz: 8a5aaee9fa9b5650cb1a148e26c456bdf75606b28e0d1a5c95ecbc1d79d3043fe2aa8623ccdf69142ecdf7bf7be3673641c7218460cb3bdb6e878b582267cc72
6
+ metadata.gz: a53eb4ddb3774358a69fb1f30db783bff4d998c3d316abe5165efc7fc907c9142fd209f15e2e21143f2e8ef0ef0e3b9ef180fde72e6adaa8d23c4631d733f1cd
7
+ data.tar.gz: e142292944f19c1ea02c9b253ec58c8f497459cac206ca99b87cde5d682de7511f57fcf7a7c129e980ea8dc343d7b98abb697159483a068f56312b500af30b6c
checksums.yaml.gz.sig CHANGED
Binary file
@@ -14,7 +14,7 @@ def release(tag)
14
14
  require "tempfile"
15
15
 
16
16
  repo = github_repo
17
- notes = release_notes(tag.to_s)
17
+ notes = context["releases:notes"].call(tag.to_s)
18
18
 
19
19
  Tempfile.create(["release-notes", ".md"]) do |file|
20
20
  file.write(notes || "")
@@ -47,35 +47,3 @@ def github_repo
47
47
 
48
48
  match[:repo]
49
49
  end
50
-
51
- def release_notes(tag, path = File.join(context.root, "releases.md"))
52
- return nil unless File.exist?(path)
53
-
54
- require "markly"
55
- document = Markly.parse(File.read(path))
56
-
57
- header = document.find_header(tag)
58
- return nil unless header
59
-
60
- fragment = Markly::Node.new(:document)
61
- node = header.next
62
- while node
63
- break if node.type == :header && node.header_level <= header.header_level
64
- next_node = node.next
65
- fragment.append_child(node)
66
- node = next_node
67
- end
68
-
69
- return nil unless fragment.first_child
70
-
71
- offset = header.header_level - 1
72
- if offset > 0
73
- fragment.walk do |node|
74
- if node.type == :header
75
- node.header_level -= offset
76
- end
77
- end
78
- end
79
-
80
- fragment.to_markdown
81
- end
data/bake/releases.rb CHANGED
@@ -1,7 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2024-2025, by Samuel Williams.
4
+ # Copyright, 2024-2026, by Samuel Williams.
5
+
6
+ # Extract the Markdown notes for a release without publishing it.
7
+ #
8
+ # @parameter tag [String] The exact release heading, e.g. "v1.2.3".
9
+ # @parameter path [String] The releases document. Defaults to releases.md in the project root.
10
+ # @returns [String | Nil] The release notes, or nil if no notes exist.
11
+ def notes(tag, path: self.releases_path)
12
+ require_relative "../lib/bake/releases"
13
+
14
+ Bake::Releases.notes(tag, path: path)
15
+ end
5
16
 
6
17
  # Update the 'Unreleased' section of the releases document with the given version number, if it exists.
7
18
  #
@@ -44,6 +44,27 @@ end
44
44
 
45
45
  When you release your gem using `bake gem:release`, the "Unreleased" section will automatically be renamed to the version number (e.g., `## v1.2.3`).
46
46
 
47
+ ### Reading Release Notes
48
+
49
+ Release automation can extract the notes for a specific version without creating a GitHub release:
50
+
51
+ ```ruby
52
+ require "bake/releases"
53
+
54
+ notes = Bake::Releases.notes("v1.2.3", path: "releases.md")
55
+ ```
56
+
57
+ The tag must match the heading in the document, including the `v` prefix. The method returns Markdown without that heading and promotes nested headings relative to it. It returns `nil` when the file, heading, or section content is missing. It does not modify the file. The default path is `releases.md` in the current working directory; pass an explicit path to read from another checkout.
58
+
59
+ The `releases:notes` Bake task returns the same Markdown string and uses `releases.md` in the project root by default:
60
+
61
+ ```bash
62
+ $ bundle exec bake releases:notes v1.2.3
63
+ $ bundle exec bake releases:notes v1.2.3 path=changes.md
64
+ ```
65
+
66
+ When publishing or retrying a release, select its exact version and read from the release commit's checkout. The existing `releases:github:release` task uses the same API to populate GitHub release notes.
67
+
47
68
  ## Best Practices for Release Notes
48
69
 
49
70
  ### Format Guidelines
data/context/index.yaml CHANGED
@@ -3,6 +3,8 @@
3
3
  ---
4
4
  description: Releases document management.
5
5
  metadata:
6
+ bug_tracker_uri: https://github.com/ioquatix/bake-releases/issues
7
+ changelog_uri: https://github.com/ioquatix/bake-releases/blob/main/releases.md
6
8
  documentation_uri: https://ioquatix.github.io/bake-releases/
7
9
  funding_uri: https://github.com/sponsors/ioquatix/
8
10
  source_code_uri: https://github.com/ioquatix/bake-releases.git
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2024-2025, by Samuel Williams.
4
+ # Copyright, 2024-2026, by Samuel Williams.
5
5
 
6
6
  module Bake
7
7
  module Releases
8
- VERSION = "0.5.4"
8
+ VERSION = "0.6.0"
9
9
  end
10
10
  end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2026, by Samuel Williams.
5
+
6
+ require_relative "releases/version"
7
+ require "markly"
8
+
9
+ # @namespace
10
+ module Bake
11
+ # Read and manage release documentation.
12
+ module Releases
13
+ # Extract a release section as Markdown without changing the source file.
14
+ # The release heading is omitted and nested headings are promoted relative to it.
15
+ #
16
+ # @parameter tag [String] The exact release heading, e.g. "v1.2.3".
17
+ # @parameter path [String] The releases document, relative to the current working directory unless absolute.
18
+ # @returns [String | Nil] The release notes, or nil if the file, heading, or section content is missing.
19
+ def self.notes(tag, path: "releases.md")
20
+ return nil unless File.exist?(path)
21
+
22
+ document = Markly.parse(File.read(path))
23
+ header = document.find_header(tag.to_s)
24
+ return nil unless header
25
+
26
+ fragment = Markly::Node.new(:document)
27
+ node = header.next
28
+ while node
29
+ break if node.type == :header && node.header_level <= header.header_level
30
+ next_node = node.next
31
+ fragment.append_child(node)
32
+ node = next_node
33
+ end
34
+
35
+ return nil unless fragment.first_child
36
+
37
+ offset = header.header_level - 1
38
+ if offset > 0
39
+ fragment.walk do |node|
40
+ if node.type == :header
41
+ node.header_level -= offset
42
+ end
43
+ end
44
+ end
45
+
46
+ fragment.to_markdown
47
+ end
48
+ end
49
+ end
data/license.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright, 2024-2025, by Samuel Williams.
3
+ Copyright, 2024-2026, by Samuel Williams.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Please see the [project releases](https://ioquatix.github.io/bake-releases/releases/index) for all releases.
4
4
 
5
+ ### v0.6.0
6
+
7
+ - Extract release notes without publishing using `Bake::Releases.notes` or the `releases:notes` Bake task.
8
+
5
9
  ### v0.5.4
6
10
 
7
11
  - Fix ambiguous constant name `Gem::Specification` -\> `::Gem::Specification`.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.6.0
4
+
5
+ - Extract release notes without publishing using `Bake::Releases.notes` or the `releases:notes` Bake task.
6
+
3
7
  ## v0.5.4
4
8
 
5
9
  - Fix ambiguous constant name `Gem::Specification` -\> `::Gem::Specification`.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bake-releases
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -75,6 +75,7 @@ files:
75
75
  - bake/releases/github.rb
76
76
  - context/getting-started.md
77
77
  - context/index.yaml
78
+ - lib/bake/releases.rb
78
79
  - lib/bake/releases/version.rb
79
80
  - license.md
80
81
  - readme.md
@@ -83,6 +84,8 @@ homepage: https://github.com/ioquatix/bake-releases
83
84
  licenses:
84
85
  - MIT
85
86
  metadata:
87
+ bug_tracker_uri: https://github.com/ioquatix/bake-releases/issues
88
+ changelog_uri: https://github.com/ioquatix/bake-releases/blob/main/releases.md
86
89
  documentation_uri: https://ioquatix.github.io/bake-releases/
87
90
  funding_uri: https://github.com/sponsors/ioquatix/
88
91
  source_code_uri: https://github.com/ioquatix/bake-releases.git
@@ -100,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
103
  - !ruby/object:Gem::Version
101
104
  version: '0'
102
105
  requirements: []
103
- rubygems_version: 4.0.3
106
+ rubygems_version: 4.0.16
104
107
  specification_version: 4
105
108
  summary: Releases document management.
106
109
  test_files: []
metadata.gz.sig CHANGED
Binary file