Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/scripts/release/update-changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/publish-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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|<version>[0-9]*\.[0-9]*\.[0-9]*</version>|<version>${VERSION}</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|<version>[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-java\.[0-9][0-9]*\)\{0,1\}</version>|<version>${VERSION}</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)
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading