diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index bfb46f3..220018a 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -1,8 +1,10 @@
name: Maven Publish
on:
+ # Run by hand on a tag to retry a failed publish.
workflow_dispatch:
- release:
- types: [published]
+ push:
+ tags:
+ - "v*"
jobs:
build:
runs-on: ubuntu-latest
@@ -20,14 +22,15 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- - name: Check release tag matches pom version
- if: github.event_name == 'release'
+ # The tag is the only source of the version; pom.xml holds a placeholder.
+ - name: Set the version from the tag
run: |
- VERSION=$(mvn -q help:evaluate -Dexpression=project.version -DforceStdout)
- if [ "${GITHUB_REF_NAME#v}" != "$VERSION" ]; then
- echo "::error::Release tag $GITHUB_REF_NAME does not match pom version $VERSION"
+ if ! [[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]]; then
+ echo "::error::$GITHUB_REF_NAME is not a version tag such as v1.2.3"
exit 1
fi
+ mvn -q org.codehaus.mojo:versions-maven-plugin:2.18.0:set \
+ -DnewVersion="${GITHUB_REF_NAME#v}" -DgenerateBackupPoms=false
- name: Publish to Apache Maven Central
run: mvn clean deploy
diff --git a/.vesnik.yaml b/.vesnik.yaml
new file mode 100644
index 0000000..bbec4ee
--- /dev/null
+++ b/.vesnik.yaml
@@ -0,0 +1,36 @@
+# vesnik tags releases and writes the GitHub Release notes for `just release` and
+# `just hotfix-release`: https://github.com/nklmilojevic/vesnik
+#
+# The tag is the only source of the version. vesnik never commits: the publish
+# workflow writes the version from the tag into pom.xml before it deploys to Maven Central.
+
+provider: claude
+model: claude-haiku-5-5
+
+# The SDK is public. GitHub's generated notes copy PR titles, which carry internal
+# ticket keys, so a release without the model stops instead of using them.
+ai:
+ on_error: fail
+
+style:
+ preset: ste100
+ product: "MailerSend Java SDK for the MailerSend API; release notes are read by developers who use the SDK."
+ rules:
+ - "Never write ticket keys such as MSD-15283 or SRE-76231, branch names, or names of internal tools and processes."
+ - "Describe each change by what it adds, changes or fixes for developers who use the SDK, such as the endpoint, method or option."
+ - "Leave out merge commits, Renovate dependency updates (\"chore(deps): ...\"), and version bump commits unless they change behavior."
+ - "Leave out reverted changes, and \"Fix\", \"Nits\" or \"update docs\" commits unless they change behavior."
+
+github:
+ append_generated_notes: false
+
+changelog:
+ enabled: false
+
+branch: main
+
+breaking_bumps_minor: true
+
+packages:
+ - path: .
+ ecosystem: none
diff --git a/README.md b/README.md
index 3fd361a..e44f465 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,7 @@
MailerSend Java SDK
+[](https://central.sonatype.com/artifact/com.mailersend/java-sdk)
[](./LICENSE)
# Table of Contents
@@ -192,17 +193,19 @@ MailerSend Java SDK
# Installation
+Replace `x.y.z` with the latest version on [Maven Central](https://central.sonatype.com/artifact/com.mailersend/java-sdk).
+
Using Maven:
com.mailersend
java-sdk
- 2.6.0
+ x.y.z
Using Gradle:
- implementation 'com.mailersend:java-sdk:2.6.0'
+ implementation 'com.mailersend:java-sdk:x.y.z'
# Usage
diff --git a/flake.lock b/flake.lock
index a3a9b5f..14fc277 100644
--- a/flake.lock
+++ b/flake.lock
@@ -18,7 +18,29 @@
},
"root": {
"inputs": {
- "nixpkgs": "nixpkgs"
+ "nixpkgs": "nixpkgs",
+ "vesnik": "vesnik"
+ }
+ },
+ "vesnik": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1792501163,
+ "narHash": "sha256-NL9FUQSh2m8WD67KBuWi0Y5jy+qkGE/0dT+BC3MJD60=",
+ "owner": "nklmilojevic",
+ "repo": "vesnik",
+ "rev": "ee5d22cdabf097da4fbcd975da9473a8be78ea28",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nklmilojevic",
+ "ref": "v0.2.0",
+ "repo": "vesnik",
+ "type": "github"
}
}
},
diff --git a/flake.nix b/flake.nix
index 6ab0cf7..e00b5ac 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,9 +3,14 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ # Release notes and versions for `just release`.
+ vesnik = {
+ url = "github:nklmilojevic/vesnik/v0.2.0";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
};
- outputs = { self, nixpkgs }:
+ outputs = { self, nixpkgs, vesnik }:
let
systems = [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ];
forEachSystem = f:
@@ -18,7 +23,8 @@
lefthook
gitleaks
git-secrets
- ];
+ just
+ ] ++ [ vesnik.packages.${system}.default ];
};
});
};
diff --git a/justfile b/justfile
new file mode 100644
index 0000000..93376e4
--- /dev/null
+++ b/justfile
@@ -0,0 +1,56 @@
+set shell := ["bash", "-uc"]
+
+[private]
+default:
+ @just --list
+
+# Release main: vesnik picks the version (minor if the model gives none) and writes the notes
+release:
+ @git checkout main
+ @git pull --tags -f
+ @just _publish-release --default-bump minor
+ @just _open "https://github.com/mailersend/mailersend-java/releases"
+
+# Release main as a patch version
+hotfix-release:
+ @git checkout main
+ @git pull --tags -f
+ @just _publish-release --bump patch
+ @just _open "https://github.com/mailersend/mailersend-java/releases"
+
+# --- Internal helpers ----------------------------------------------------------------
+
+# Tag main and publish the GitHub Release with vesnik from PATH or the Nix dev
+# shell; the tag push starts the Maven Central publish workflow. Without vesnik, the
+# version is typed by hand. VESNIK_YES=1 skips vesnik's review.
+[private]
+_publish-release +flags:
+ #!/usr/bin/env bash
+ set -uo pipefail
+ vesnik=""
+ if command -v vesnik >/dev/null 2>&1; then
+ vesnik="vesnik"
+ elif command -v nix >/dev/null 2>&1; then
+ vesnik="nix develop --command vesnik"
+ fi
+ if [ -n "$vesnik" ]; then
+ review=""
+ if [ "${VESNIK_YES:-}" = 1 ]; then review="--yes"; fi
+ $vesnik release {{flags}} $review
+ case $? in
+ 0) exit 0 ;;
+ 3) echo "Release aborted; nothing was tagged." >&2; exit 1 ;;
+ 4) echo "The tag is pushed but the GitHub Release failed; run: vesnik renote " >&2; exit 1 ;;
+ *) echo "vesnik failed before tagging; falling back to the manual release." >&2 ;;
+ esac
+ fi
+ echo "> Latest version:"
+ git tag -l --sort=-creatordate | head -n 1
+ read -r VERSION || exit 1
+ # No --generate-notes: it copies PR titles, which carry internal ticket keys.
+ gh release create "$VERSION" --target main --notes "" || exit 1
+ echo "Add the release notes: vesnik renote $VERSION"
+
+[private]
+_open url:
+ @if [ "$(uname -s)" = "Darwin" ]; then open "{{url}}"; elif command -v xdg-open >/dev/null 2>&1; then xdg-open "{{url}}"; else echo "{{url}}"; fi
diff --git a/pom.xml b/pom.xml
index 4913b49..db3eaee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
com.mailersend
java-sdk
- 2.6.0
+ 0.0.0-SNAPSHOT
MailerSend Java SDK
An SDK for MailerSend API
https://github.com/mailersend/mailersend-java