|
| 1 | +# Release procedure |
| 2 | + |
| 3 | +## Off the `main` branch |
| 4 | + |
| 5 | +Instructions for a new major, new minor, or a patch when this would make it the latest version (e.g. 2.2.1 when latest version is 2.2.0) |
| 6 | + |
| 7 | +Ensure you have the latest changes locally, and no uncommitted changes: |
| 8 | + |
| 9 | +```shell |
| 10 | +git pull --ff-only |
| 11 | +git status |
| 12 | +``` |
| 13 | + |
| 14 | +Set the version locally: |
| 15 | + |
| 16 | +```shell |
| 17 | +export RELEASE_VERSION=2.2.0 |
| 18 | +export NEXT_VERSION=2.2.1-SNAPSHOT |
| 19 | +``` |
| 20 | + |
| 21 | +Update the versions: |
| 22 | + |
| 23 | +```shell |
| 24 | +# Update version in pom |
| 25 | +./mvnw versions:set -DgenerateBackupPoms=false -DnewVersion=$RELEASE_VERSION |
| 26 | +``` |
| 27 | + |
| 28 | +Update the docs (`docs/quickstart.md` and `mkdocs.yml`) to point to the new release version: |
| 29 | + |
| 30 | +```shell |
| 31 | +# "-i.bak" works with both GNU and BSD (macOS) sed, unlike a bare "-i". |
| 32 | + |
| 33 | +sed -i.bak \ |
| 34 | + -e "s|<version>[^<]*</version>|<version>${RELEASE_VERSION}</version>|g" \ |
| 35 | + -e "s|mcp-bom:[^\"]*\"|mcp-bom:${RELEASE_VERSION}\"|g" \ |
| 36 | + docs/quickstart.md |
| 37 | +rm docs/quickstart.md.bak |
| 38 | + |
| 39 | +sed -i.bak "s|\(mcp-core/\)[0-9][^ ]*|\1${RELEASE_VERSION}|" mkdocs.yml |
| 40 | +rm mkdocs.yml.bak |
| 41 | +``` |
| 42 | + |
| 43 | +Commit everything and tag: |
| 44 | + |
| 45 | +```shell |
| 46 | +git add pom.xml mkdocs.yml docs/quickstart.md "**/pom.xml" |
| 47 | +git commit --signoff --message "Release version $RELEASE_VERSION" |
| 48 | +git tag --annotate "v$RELEASE_VERSION" --message "Release version $RELEASE_VERSION" |
| 49 | +``` |
| 50 | + |
| 51 | +Review the commit and the tag (`git show "v$RELEASE_VERSION"`), then prepare the next version: |
| 52 | + |
| 53 | +```shell |
| 54 | +# Update version in pom |
| 55 | +./mvnw versions:set -DgenerateBackupPoms=false -DnewVersion=$NEXT_VERSION |
| 56 | + |
| 57 | +git add pom.xml "**/pom.xml" |
| 58 | +git commit --signoff --message "Next development version" |
| 59 | +``` |
| 60 | + |
| 61 | +Review the commit (`git show`). |
| 62 | + |
| 63 | +> ⚠️ Take a good review before pushing! |
| 64 | +
|
| 65 | +Then push it all: |
| 66 | + |
| 67 | +```shell |
| 68 | +git push --tags origin HEAD |
| 69 | +``` |
| 70 | + |
| 71 | +Then release from the "[Release to Maven Central](https://github.com/modelcontextprotocol/java-sdk/actions/workflows/maven-central-release.yml)" action. Click "Run workflow", choose the newly pushed tag, then "run workflow". |
| 72 | + |
| 73 | +Create release notes. |
0 commit comments