ci(release): add release pipeline and switch versioning to git-semver#221
Conversation
…/num0001/plot-system into feat/release-workflow-and-semver
…d/git-semver Replaces the hardcoded `"5.0.3" + gitHash + "-SNAPSHOT"` expression with `version = semver.semVersion`. The project version is now derived from the latest vMAJOR.MINOR.PATCH tag plus the conventional-commit messages since that tag, so release builds produce clean version numbers (e.g. PlotSystem-5.0.3.jar) without manual edits to build.gradle.kts before each release. Also adds a `printNextReleaseVersion` helper task used by the release-draft workflow. The plugin's `printVersion` task includes a `-SNAPSHOT` suffix on commits between releases, which is correct for the JAR version but wrong for the draft release tag — the helper strips the suffix so the draft tag is e.g. `v5.0.3` instead of `v5.0.3-SNAPSHOT`. The value is computed at task-configuration time so the task stays compatible with the project's configuration cache.
Adds release-draft.yml plus the release-drafter config. On each push to main the workflow runs `./gradlew -q printNextReleaseVersion` to compute the next clean release version, then hands it to release-drafter/release-drafter@v6, which keeps a single draft release in sync — updating the "What's Changed" section and bumping the tag if the computed version changes. The draft is editable; the maintainer publishes it manually when ready. Categorisation in the draft uses three sections (Features, Bug Fixes, Maintenance) mapped to the labels already in use on this repo (enhancement, bug, dependencies, documentation). PRs without a matching label fall under the uncategorised list.
|
Hey, thanks for tackling this issue! |
|
Make sure to pull the latest changes from main and implement the changes requested by Zoriot from the closed PR, other than that LGTM. Ill approve once done. |
I already fix all requests, plz check it out. |
There was a problem hiding this comment.
Pull request overview
This PR introduces a GitHub-native release lifecycle for Plot-System and switches Gradle versioning from a hardcoded git-hash snapshot string to semver derived from git tags + conventional-commit history.
Changes:
- Replace
com.palantir.git-versionwithcom.github.jmongard.git-semver-pluginand setproject.versionfrom the semver plugin. - Add a Gradle helper task (
printNextReleaseVersion) to output the next “clean” release version for automation. - Add two new GitHub Actions workflows (
release-draft.yml,release.yml) plus arelease-drafterconfiguration to maintain a single draft release and attach built artifacts on publish.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
gradle/libs.versions.toml |
Swaps the git-version plugin dependency for the git-semver plugin in the version catalog. |
build.gradle.kts |
Switches version to semver.semVersion and adds printNextReleaseVersion for workflows. |
.github/workflows/release.yml |
New workflow to build from a published release tag and upload JAR artifacts to the release. |
.github/workflows/release-draft.yml |
New workflow to compute the next version on main and update/maintain a draft release via release-drafter. |
.github/release-drafter.yml |
New release-drafter configuration (templates + label-based categories). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Upgrade workflow dependencies (`actions/checkout`, `gradle/actions/setup-gradle`, `softprops/action-gh-release`, `actions/upload-artifact`, and `release-drafter/release-drafter`) to their latest stable versions for improved compatibility and performance.
Closes #194. Partially addresses #149 (the README overhaul will follow in a separate PR).
Sets up the full release lifecycle for Plot-System and replaces the hardcoded
"5.0.3"-<hash>-SNAPSHOTversion expression with one derived from git tags + conventional-commit history.New release flow
build.yml(existing, unchanged)mainrelease-draft.yml(new)release: publishedrelease.yml(new)Changes
Versioning
gradle/libs.versions.toml: swappalantir/gradle-git-version(5.0.0) forjmongard/git-semver-plugin(0.19.0).build.gradle.kts: replace hardcoded version withsemver.semVersion. Adds aprintNextReleaseVersionhelper task that returns the next clean version (stripped of the-SNAPSHOTsuffix the plugin adds between tags). The task captures its value at configuration time so it stays compatible with the project's configuration cache.Draft release maintenance (new)
.github/workflows/release-draft.yml: runs on push tomain. Calls./gradlew -q printNextReleaseVersionand feeds the result torelease-drafter/release-drafter@v6..github/release-drafter.yml: minimal config with three categories (Features, Bug Fixes, Maintenance) mapped to existing repo labels (enhancement,bug,dependencies,documentation). PRs without a matching label fall under the uncategorised list.Release artifact upload (new)
.github/workflows/release.yml: runs onrelease: published, checks out the release tag, builds, and attachesbuild/libs/*.jarviasoftprops/action-gh-release@v2. Uses the defaultGITHUB_TOKENwithcontents: write— no extra secrets required.Commit convention going forward
With the new semver plugin active, conventional-commit prefixes drive the next version bump:
feat: …fix: …feat!:or footerBREAKING CHANGE:build:/ci:/chore:/docs:/refactor:/test:This PR's commits use
build(gradle):andci(release):so merging it does not bump the version on its own.Caveats / notes
main(release-drafter regenerates the "What's Changed" section each run). Intended workflow: pause merging → polish the draft → publish. Splitting the body into auto/manual regions is doable as a follow-up if needed.gh api .../releases/generate-notesand appends just that section.Out of scope (intentionally deferred)
Test plan
./gradlew clean buildpasses locally with the new plugin../gradlew -q printNextReleaseVersionreturns the clean version (no-SNAPSHOT) and is configuration-cache compatible.release-draft.ymlproduces a draft visible on the Releases page.release.ymland the resulting release hasPlotSystem-<version>.jarattached.