|
| 1 | +--- |
| 2 | +name: prepare-release |
| 3 | +description: Prepares a torchjd package release by verifying the changelog, README, bumping the version in pyproject.toml, and opening a release PR. Use when a maintainer asks to prepare a release or to release. |
| 4 | +--- |
| 5 | + |
| 6 | +# Prepare TorchJD Release |
| 7 | + |
| 8 | +This skill covers the pre-merge steps of the release process. |
| 9 | + |
| 10 | +**For agents:** invoke as `/prepare-release X.Y.Z` (e.g. `/prepare-release 0.16.0`). |
| 11 | +If no version is provided, read the current version from `pyproject.toml` and ask the user |
| 12 | +what the new version should be before proceeding. |
| 13 | + |
| 14 | +**For humans:** follow the numbered steps below in your terminal. |
| 15 | +Replace `X.Y.Z` with the version you are releasing and `yyyy-mm-dd` with today's date. |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Instructions |
| 20 | + |
| 21 | +### Step 1: Determine the version |
| 22 | + |
| 23 | +Read `pyproject.toml` to find the current `version` field under `[project]`. The new release |
| 24 | +version is either provided as an argument or must be confirmed with the user before continuing. |
| 25 | + |
| 26 | +Verify it follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
| 27 | + |
| 28 | +### Step 2: Verify CHANGELOG |
| 29 | + |
| 30 | +Read `CHANGELOG.md` and compare it against the commits done since the last version release. Verify that no user-facing change was forgotten, and that all were correctly added under the [Unreleased] section. |
| 31 | + |
| 32 | +### Step 3: Check README for interface changes |
| 33 | + |
| 34 | +Read `CHANGELOG.md` and identify any entries in the `[Unreleased]` section that affect the public |
| 35 | +interface (new or removed classes, functions, or arguments; changed signatures or behavior). |
| 36 | + |
| 37 | +If such entries exist, read `README.md` and verify it accurately describes the current interface. |
| 38 | + |
| 39 | +If a table listing methods exists in `README.md`, add to it any newly added method of the corresponding type. |
| 40 | + |
| 41 | +If anything else seems missing, report that to the user. |
| 42 | + |
| 43 | +### Step 4: Run the unit tests |
| 44 | + |
| 45 | +CRITICAL: Do not skip this step, even partially. |
| 46 | + |
| 47 | +Run the unit tests and confirm they all pass both on CPU and GPU (you need a CUDA-enabled GPU for this): |
| 48 | + |
| 49 | +```bash |
| 50 | +uv run pytest tests/unit |
| 51 | +PYTEST_TORCH_DEVICE=cuda:0 uv run pytest tests/unit |
| 52 | +``` |
| 53 | + |
| 54 | +If any tests fail, stop and report the failures. Do not proceed to the next steps. |
| 55 | + |
| 56 | +### Step 5: Add the version header to the changelog |
| 57 | + |
| 58 | +In `CHANGELOG.md`, insert a new `## [X.Y.Z] - yyyy-mm-dd` heading immediately after the blank |
| 59 | +line that follows `## [Unreleased]`, before the existing subsections: |
| 60 | + |
| 61 | +```diff |
| 62 | + ## [Unreleased] |
| 63 | + |
| 64 | ++## [X.Y.Z] - yyyy-mm-dd |
| 65 | ++ |
| 66 | + ### Added |
| 67 | +``` |
| 68 | + |
| 69 | +The `[Unreleased]` section stays in place and will accumulate entries for the next release. |
| 70 | +The newly-inserted heading claims the existing content as its own. |
| 71 | + |
| 72 | +### Step 6: Bump the version in `pyproject.toml` |
| 73 | + |
| 74 | +In `pyproject.toml`, update the `version` field under `[project]`: |
| 75 | + |
| 76 | +```diff |
| 77 | +-version = "A.B.C" |
| 78 | ++version = "X.Y.Z" |
| 79 | +``` |
| 80 | + |
| 81 | +### Step 7: Open the release PR |
| 82 | + |
| 83 | +Stage changes, then open a pull request targeting `main`. |
| 84 | +Return the PR URL when done. |
| 85 | + |
| 86 | +### Step 8: Create a draft release on GitHub |
| 87 | + |
| 88 | +CRITICAL: The release you'll create should ALWAYS be a draft. Never even suggest to make the real release. A maintainer will manually release the draft if it seems ready. |
| 89 | + |
| 90 | +The command should be: |
| 91 | +``` |
| 92 | +gh release create vX.Y.Z --draft --title vX.Y.Z --notes "<insert notes here>" |
| 93 | +``` |
| 94 | + |
| 95 | +To write the actual release notes, look at what is done in recent releases and suggest the new notes. Make it short. Also, prompt the user for an good-looking emoji (propose a list of 10) to use in the main section of the release notes. |
| 96 | + |
| 97 | +--- |
| 98 | + |
0 commit comments