To release a new version of SwiftPoet, follow these steps to update documentation, set version variables, update project files via sed, tag the release in Git, and prepare the development branch for the next version.
1. Update Changelog
Update CHANGELOG.md with the new release details.
2. Set Version Environment Variables
Define the current release version and the subsequent snapshot version:
export RELEASE_VERSION=X.Y.Z
export NEXT_VERSION=X.Y.Z-SNAPSHOT
3. Update Project Files
Use sed to update version strings in README.md and gradle.properties. This ensures that dependency references, documentation URLs, and Gradle properties reflect the new $RELEASE_VERSION.
4. Tag and Push the Release
Create a release branch, commit the changes, tag it, and push to GitHub:
git checkout -b release.$RELEASE_VERSION
git commit -am "Prepare for release $RELEASE_VERSION."
git tag -a $RELEASE_VERSION -m "Version $RELEASE_VERSION"
git push && git push --tags
5. Merge and Automate
Merge the release branch once CI passes. The CI pipeline will automatically release the artifacts upon merge.
6. Prepare for Ongoing Development
Switch to a new development branch and update gradle.properties to the $NEXT_VERSION to prepare for the next development cycle:
git checkout -b dev.$NEXT_VERSION
sed -i "" "s/releaseVersion=.*/releaseVersion=$NEXT_VERSION/g" `find . -name "gradle.properties"`
git commit -am "Prepare next development version."
git push
Once pushed, CI will release the artifact and publish the documentation.
export RELEASE_VERSION=X.Y.Z
export NEXT_VERSION=X.Y.Z-SNAPSHOT
git checkout -b release.$RELEASE_VERSION
git commit -am "Prepare for release $RELEASE_VERSION."
git tag -a $RELEASE_VERSION -m "Version $RELEASE_VERSION"
git push && git push --tags