diff --git a/.github/scripts/release/update-changelog.sh b/.github/scripts/release/update-changelog.sh
index 6dfedbf1c..a18d35b02 100755
--- a/.github/scripts/release/update-changelog.sh
+++ b/.github/scripts/release/update-changelog.sh
@@ -53,7 +53,7 @@ BEGIN {
}
# Capture the repository URL from the first version link
-links_section && repo_url == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+\]:/ {
+links_section && repo_url == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?\]:/ {
match($0, /(https:\/\/github\.com\/[^\/]+\/[^\/]+)\//, arr)
if (arr[1] != "") {
repo_url = arr[1]
@@ -87,8 +87,8 @@ skip_old_upstream && /^> \*\*Upstream sync:\*\*/ { next }
skip_old_upstream && !/^[[:space:]]*$/ && !/^> \*\*Upstream sync:\*\*/ { skip_old_upstream = 0 }
# Capture the first version link to get the previous version
-links_section && first_version_link == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+\]:/ {
- match($0, /\[([0-9]+\.[0-9]+\.[0-9]+)\]:/, arr)
+links_section && first_version_link == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?\]:/ {
+ match($0, /\[([0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?)\]:/, arr)
if (arr[1] != "" && repo_url != "") {
first_version_link = arr[1]
# Insert Unreleased and new version links before first version link
@@ -100,7 +100,7 @@ links_section && first_version_link == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+\]:/ {
# Update existing [Unreleased] link if present
links_section && /^\[Unreleased\]:/ {
# Get the previous version and repo URL from the existing link
- match($0, /(https:\/\/github\.com\/[^\/]+\/[^\/]+)\/compare\/v([0-9]+\.[0-9]+\.[0-9]+)\.\.\.HEAD/, arr)
+ match($0, /(https:\/\/github\.com\/[^\/]+\/[^\/]+)\/compare\/v([0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?)\.\.\.HEAD/, arr)
if (arr[1] != "" && arr[2] != "") {
print "[Unreleased]: " arr[1] "/compare/v" version "...HEAD"
print "[" version "]: " arr[1] "/compare/v" arr[2] "...v" version
diff --git a/.github/workflows/publish-maven.yml b/.github/workflows/publish-maven.yml
index 2adfc317d..cef191684 100644
--- a/.github/workflows/publish-maven.yml
+++ b/.github/workflows/publish-maven.yml
@@ -81,10 +81,18 @@ jobs:
if [ -n "${{ inputs.developmentVersion }}" ]; then
DEV_VERSION="${{ inputs.developmentVersion }}"
else
- # Increment patch version and add -SNAPSHOT
- IFS='.' read -r MAJOR MINOR PATCH <<< "$RELEASE_VERSION"
+ # Split version: supports both "0.1.32" and "0.1.32-java.0" formats
+ # Validate RELEASE_VERSION format explicitly to provide clear errors
+ if ! echo "$RELEASE_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?$'; then
+ echo "Error: RELEASE_VERSION '$RELEASE_VERSION' is invalid. Expected format: M.M.P or M.M.P-java.N (e.g., 1.2.3 or 1.2.3-java.0)." >&2
+ exit 1
+ fi
+ # Extract the base M.M.P portion (before any qualifier)
+ BASE_VERSION=$(echo "$RELEASE_VERSION" | grep -oE '^[0-9]+\.[0-9]+\.[0-9]+')
+ QUALIFIER=$(echo "$RELEASE_VERSION" | sed "s|^${BASE_VERSION}||")
+ IFS='.' read -r MAJOR MINOR PATCH <<< "$BASE_VERSION"
NEXT_PATCH=$((PATCH + 1))
- DEV_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}-SNAPSHOT"
+ DEV_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}${QUALIFIER}-SNAPSHOT"
fi
echo "Next development version: $DEV_VERSION"
@@ -109,12 +117,12 @@ jobs:
# Update CHANGELOG.md with release version and upstream sync hash
./.github/scripts/release/update-changelog.sh "${VERSION}" "${UPSTREAM_HASH}"
- # Update version in README.md
- sed -i "s|[0-9]*\.[0-9]*\.[0-9]*|${VERSION}|g" README.md
- sed -i "s|copilot-sdk-java:[0-9]*\.[0-9]*\.[0-9]*|copilot-sdk-java:${VERSION}|g" README.md
+ # Update version in README.md (supports versions like 1.0.0 and 0.1.32-java.0)
+ sed -i "s|[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|${VERSION}|g" README.md
+ sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" README.md
# Update version in jbang-example.java
- sed -i "s|copilot-sdk-java:[0-9]*\.[0-9]*\.[0-9]*|copilot-sdk-java:${VERSION}|g" jbang-example.java
+ sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}|copilot-sdk-java:${VERSION}|g" jbang-example.java
# Update version in cookbook files (Maven will filter ${project.version} during site generation,
# but we also need the actual version for direct JBang usage)
@@ -190,7 +198,7 @@ jobs:
# Get the previous tag for generating notes
PREV_TAG=$(git tag --list 'v*' --sort=-version:refname \
- | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
+ | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?$' \
| grep -Fxv "${CURRENT_TAG}" \
| head -n 1)
diff --git a/README.md b/README.md
index 2fc4a3647..0feeae8f7 100644
--- a/README.md
+++ b/README.md
@@ -60,7 +60,7 @@ Snapshot builds of the next development version are published to Maven Central S
### Gradle
```groovy
-implementation 'com.github:copilot-sdk-java:0.1.32'
+implementation 'com.github:copilot-sdk-java:0.1.32-java.0'
```
## Quick Start