@@ -103,13 +103,13 @@ release-tool push 9.1.0 --release-mode draft
103103release-tool push 9.1.0 --release-mode published
104104
105105# Mark existing release as published (no tag operations)
106- release-tool push 9.1.0 --release-mode just-push
106+ release-tool push 9.1.0 --release-mode mark-published
107107```
108108
109109** Mode Details** :
110110- ` draft ` : Creates GitHub release with ` draft: true ` (not public)
111111- ` published ` : Creates/updates full release with tags and notes
112- - ` just-push ` : Only marks existing release as published (no tag/note changes)
112+ - ` mark-published ` : Only marks existing release as published (no tag/note changes)
113113 - ✅ Perfect for automation (e.g., PR merge triggers)
114114 - ✅ Preserves all existing release properties
115115 - ❌ Fails if no existing release found
@@ -187,6 +187,88 @@ release-tool push 9.1.0 --prerelease false # Force stable
187187release-tool push 9.1.0 --prerelease auto # Auto-detect
188188```
189189
190+ ### 5. Merge Release
191+
192+ The ` merge ` command automates the final steps of the release process by:
193+ 1 . Merging the associated PR (if not already merged)
194+ 2 . Marking the release as published (from draft to published)
195+ 3 . Closing the related issue (if not already closed)
196+
197+ This is particularly useful for finalizing a release in one atomic operation.
198+
199+ #### Basic Usage
200+
201+ ``` bash
202+ # Merge with auto-detection from issue
203+ release-tool merge --issue 42
204+
205+ # Specify full version
206+ release-tool merge 1.2.3 --issue 42
207+
208+ # Specify partial version (auto-completes)
209+ release-tool merge 1.2 --issue 42
210+
211+ # Explicitly specify PR number
212+ release-tool merge 1.2.3 --pr 123 --issue 42
213+
214+ # Dry-run to preview actions
215+ release-tool merge 1.2.3 --issue 42 --dry-run
216+ ```
217+
218+ #### Auto-Detection
219+
220+ The merge command intelligently auto-detects missing information:
221+
222+ ** Version Detection** :
223+ - From issue association in database
224+ - From partial version match (finds matching full versions with open PR/issue)
225+ - Shows first 5 matches if multiple found (prompts for selection or uses first with ` --auto ` )
226+
227+ ** PR Detection** :
228+ - From PRs referencing the provided issue number
229+ - Searches both open and closed PRs
230+
231+ ** Issue Detection** :
232+ - From version association in database
233+
234+ #### Behavior
235+
236+ ** Idempotent** : Gracefully skips already-completed steps:
237+ - If PR is already merged, continues to mark release published
238+ - If release is already published, continues to close issue
239+ - If issue is already closed, completes successfully
240+
241+ ** Safe** : Shows clear status for each operation
242+ ** Flexible** : Works with full or partial versions
243+
244+ #### Examples
245+
246+ ** Example 1: Full workflow from issue**
247+ ``` bash
248+ # Auto-detect version, PR, and complete merge
249+ release-tool merge --issue 42
250+ ```
251+
252+ ** Example 2: Partial version with auto-completion**
253+ ``` bash
254+ # Finds matching versions starting with "1.2"
255+ release-tool merge 1.2 --issue 42
256+
257+ # If multiple matches:
258+ # 1.2.0 (Issue #42, PR #123)
259+ # 1.2.1 (Issue #45, PR #124)
260+ # Select a number (or 'c' to cancel): 1
261+ ```
262+
263+ ** Example 3: Preview before executing**
264+ ``` bash
265+ release-tool merge 1.2.3 --issue 42 --dry-run
266+ # Output shows:
267+ # Step 1: Would merge PR #123
268+ # Step 2: Would mark release 1.2.3 as published
269+ # Step 3: Would close issue #42
270+ ```
271+
190272## Common Commands
191273
192274| Command | Description |
@@ -197,9 +279,10 @@ release-tool push 9.1.0 --prerelease auto # Auto-detect
197279| ` generate --dry-run ` | Preview generated notes without creating files |
198280| ` list-releases ` | Lists releases from the database with filters |
199281| ` publish <version> ` | Creates a GitHub release (auto-finds draft notes) |
282+ | ` merge [version] ` | Merges PR, marks release published, and closes issue in one step |
200283| ` publish <version> -f <file> ` | Creates a GitHub release from a markdown file |
201284| ` publish <version> --issue <number> ` | Associate release with a GitHub issue |
202- | ` publish <version> --release-mode draft\|published\|just-push ` | Control release creation mode |
285+ | ` publish <version> --release-mode draft\|published\|mark-published ` | Control release creation mode |
203286| ` publish --list ` or ` publish -l ` | List all available draft releases |
204287| ` publish --dry-run ` | Preview publish operation without making changes |
205288| ` publish --debug ` | Show detailed debugging information |
0 commit comments