@@ -72,3 +72,118 @@ uv can also be used to run scripts:
72
72
> uv sync
73
73
> uv run render
74
74
```
75
+
76
+ ## Design
77
+
78
+ The Smithy changelog tool is designed to make releases easier to automate by
79
+ removing the manual effort of assembling the changelog for every release without
80
+ introducing regular merge conflicts in pull requests. This follows the same
81
+ overall design used by many AWS SDKs, but adapted to the formatting and
82
+ requirements of Smithy.
83
+
84
+ The changelog tool is a set of scripts written in Python. Python is used instead
85
+ of Java for its simplicity and ease of writing command line scripts.
86
+
87
+ These scripts create and manage two sets of JSON files that describe changes and
88
+ releases. The ` new-change ` script creates a JSON file that describes a single
89
+ change.
90
+
91
+ ``` json
92
+ {
93
+ "type" : " bugfix" ,
94
+ "description" : " Example description." ,
95
+ "pull_requests" : [
96
+ " [#9999](https://github.com/smithy-lang/smithy/pull/9999)"
97
+ ]
98
+ }
99
+ ```
100
+
101
+ These change files are named in the pattern ` {type}-{sha1}.json ` where ` sha1 ` is
102
+ a hash of the JSON itself. This usage of sha1 is intended to produce file names
103
+ that are short but not likely to collide.
104
+
105
+ The change files are stored in ` .changes/next-release ` until a release happens.
106
+ Upon release, all staged changelog entries are deleted and merged into a release
107
+ file.
108
+
109
+ ``` json
110
+ {
111
+ "version" : " 9.99.99" ,
112
+ "changes" : [
113
+ {
114
+ "type" : " bugfix" ,
115
+ "description" : " Example description." ,
116
+ "pull_requests" : [
117
+ " [#9999](https://github.com/smithy-lang/smithy/pull/9999)"
118
+ ]
119
+ }
120
+ ],
121
+ "date" : " 2042-12-25"
122
+ }
123
+ ```
124
+
125
+ These release files are named in the pattern ` {version}.json ` and are stored in
126
+ ` .changes/releases ` . During a release, all of the release files are read and
127
+ rendered into the new ` CHANGELOG.md ` using the ` render ` script.
128
+
129
+ ### Special-case Releases
130
+
131
+ A very small number of releases need to have more complex changelog entries than
132
+ the standard formatting allows. In these cases, a hand-written markdown file
133
+ represents the release in ` .changes/releases ` instead of a JSON file. Currently
134
+ this is only used in the 1.0.0 release, and likely will only be needed for
135
+ similarly major releases.
136
+
137
+ ### GitHub Automation
138
+
139
+ #### Pull Requests
140
+
141
+ GitHub automation will exist to reduce the chances of prs going without
142
+ changelog entries. A comment will be automatically posted to pull requests if
143
+ they lack a staged changelog entry. This comment will remind the requester to
144
+ create one if necessary and instruct them how to do it.
145
+
146
+ If a pull request contains a staged changelog entry, but that entry lacks a link
147
+ to the pull request, a review comment will be posted. This review comment will
148
+ include a commitable suggestion that adds the link. Adding the link via a review
149
+ comment is done because it allows the requester to review the change before it
150
+ is added. Additionally, pushing a commit would be difficult as the permissions
151
+ and process vary depending on whether the pr originated from a fork.
152
+
153
+ These actions will be performed by the ` amend ` script.
154
+
155
+ #### Releases
156
+
157
+ A manually-triggered GitHub workflow will bump the Smithy version, gather the
158
+ pending changes into a release defintiion, and render the new changelog. It will
159
+ then create a pull request with these changes.
160
+
161
+ The workflow will have an input argument to select either a major or minor version
162
+ bump. The default will depend on the types of staged changes. If there are any
163
+ breaking or feature changes, a minor version bump will be the default. Otherwise,
164
+ a patch version bump will be the default.
165
+
166
+ ### Alternatives
167
+
168
+ #### Enforce PRs Update Markdown
169
+
170
+ An alternative to a changelog tool would be to enforce that pull requests
171
+ include manual updates to ` CHANGELOG.md ` . Since every pull request would be
172
+ updating the same lines of that file, this would cause churn in most pull
173
+ requests when there is an inevitable merge conflict.
174
+
175
+ Building automation around this would be more difficult and error-prone. While
176
+ markdown is relatively straightforward to parse, it is nevertheless more
177
+ difficult than working with JSON. Performing releases, making formatting
178
+ changes, detecting new entries (or the lack thereof), all would be more
179
+ difficult, requiring more development and maintenance effort that could better
180
+ be spent working on features.
181
+
182
+ #### Do Nothing
183
+
184
+ Doing nothing means that whoever runs a release must continue to do the manual
185
+ effort of putting together release notes prior to running a release. This can be
186
+ time-consuming when there have been a lot of pull requests. As with any manual
187
+ effort, especially repetitive manual effort, this can be error prone. A PR can
188
+ easily be missed when reviewing introduced features, and context can be lost
189
+ when writing release notes for a feature you neither wrote nor reviewed.
0 commit comments