bake-releases 0.5.3 → 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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/releases/github.rb +8 -41
- data/bake/releases.rb +12 -1
- data/context/getting-started.md +21 -0
- data/context/index.yaml +2 -0
- data/lib/bake/releases/version.rb +2 -2
- data/lib/bake/releases.rb +49 -0
- data/license.md +1 -1
- data/readme.md +8 -0
- data/releases.md +8 -0
- data.tar.gz.sig +0 -0
- metadata +5 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d70acb13cdf265f825f2f48727a0a588fa84bbbe2b20ad66515912ea2f808569
|
|
4
|
+
data.tar.gz: 66e5d779098dc41c1155977e5737420093e16ba39f53fd294a310767e213272c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a53eb4ddb3774358a69fb1f30db783bff4d998c3d316abe5165efc7fc907c9142fd209f15e2e21143f2e8ef0ef0e3b9ef180fde72e6adaa8d23c4631d733f1cd
|
|
7
|
+
data.tar.gz: e142292944f19c1ea02c9b253ec58c8f497459cac206ca99b87cde5d682de7511f57fcf7a7c129e980ea8dc343d7b98abb697159483a068f56312b500af30b6c
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/bake/releases/github.rb
CHANGED
|
@@ -9,24 +9,23 @@
|
|
|
9
9
|
# Uses the `gh` command-line tool to create the release.
|
|
10
10
|
# Release notes are extracted from `releases.md` for the given version; if none are found, the release is created with empty notes.
|
|
11
11
|
#
|
|
12
|
-
# @parameter
|
|
13
|
-
def release(
|
|
12
|
+
# @parameter tag [String] The tag name of the release, e.g. "v1.2.3".
|
|
13
|
+
def release(tag)
|
|
14
14
|
require "tempfile"
|
|
15
15
|
|
|
16
16
|
repo = github_repo
|
|
17
|
-
notes =
|
|
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 || "")
|
|
21
21
|
file.flush
|
|
22
22
|
|
|
23
23
|
system(
|
|
24
|
-
"gh", "release", "create",
|
|
24
|
+
"gh", "release", "create", tag.to_s,
|
|
25
25
|
"--repo", repo,
|
|
26
|
-
"--title",
|
|
27
|
-
"--notes-file", file.path
|
|
28
|
-
|
|
29
|
-
) or raise "Failed to create GitHub release for #{tag_name}"
|
|
26
|
+
"--title", tag.to_s,
|
|
27
|
+
"--notes-file", file.path
|
|
28
|
+
) or raise "Failed to create GitHub release for #{tag}"
|
|
30
29
|
end
|
|
31
30
|
end
|
|
32
31
|
|
|
@@ -38,7 +37,7 @@ def github_repo
|
|
|
38
37
|
gemspec_path = Dir.glob(File.join(context.root, "*.gemspec")).first
|
|
39
38
|
raise "No gemspec found in #{context.root}" unless gemspec_path
|
|
40
39
|
|
|
41
|
-
spec = Gem::Specification.load(gemspec_path)
|
|
40
|
+
spec = ::Gem::Specification.load(gemspec_path)
|
|
42
41
|
|
|
43
42
|
source_uri = spec.metadata&.dig("source_code_uri") || spec.homepage
|
|
44
43
|
raise "No source_code_uri or homepage found in gemspec" unless source_uri
|
|
@@ -48,35 +47,3 @@ def github_repo
|
|
|
48
47
|
|
|
49
48
|
match[:repo]
|
|
50
49
|
end
|
|
51
|
-
|
|
52
|
-
def release_notes(tag_name, path = File.join(context.root, "releases.md"))
|
|
53
|
-
return nil unless File.exist?(path)
|
|
54
|
-
|
|
55
|
-
require "markly"
|
|
56
|
-
document = Markly.parse(File.read(path))
|
|
57
|
-
|
|
58
|
-
header = document.find_header(tag_name)
|
|
59
|
-
return nil unless header
|
|
60
|
-
|
|
61
|
-
fragment = Markly::Node.new(:document)
|
|
62
|
-
node = header.next
|
|
63
|
-
while node
|
|
64
|
-
break if node.type == :header && node.header_level <= header.header_level
|
|
65
|
-
next_node = node.next
|
|
66
|
-
fragment.append_child(node)
|
|
67
|
-
node = next_node
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
return nil unless fragment.first_child
|
|
71
|
-
|
|
72
|
-
offset = header.header_level - 1
|
|
73
|
-
if offset > 0
|
|
74
|
-
fragment.walk do |node|
|
|
75
|
-
if node.type == :header
|
|
76
|
-
node.header_level -= offset
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
fragment.to_markdown
|
|
82
|
-
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-
|
|
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
|
#
|
data/context/getting-started.md
CHANGED
|
@@ -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
|
|
@@ -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
data/readme.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
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
|
+
|
|
9
|
+
### v0.5.4
|
|
10
|
+
|
|
11
|
+
- Fix ambiguous constant name `Gem::Specification` -\> `::Gem::Specification`.
|
|
12
|
+
|
|
5
13
|
### v0.5.3
|
|
6
14
|
|
|
7
15
|
- Don't strip whitespace from release notes.
|
data/releases.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
7
|
+
## v0.5.4
|
|
8
|
+
|
|
9
|
+
- Fix ambiguous constant name `Gem::Specification` -\> `::Gem::Specification`.
|
|
10
|
+
|
|
3
11
|
## v0.5.3
|
|
4
12
|
|
|
5
13
|
- Don't strip whitespace from release notes.
|
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.
|
|
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.
|
|
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
|