Skip to content

Commit f01f466

Browse files
authored
Merge pull request #11 from github/edburns/dd-2794379-cosmetic-post-public-fixes
On branch edburns/dd-2794379-cosmetic-post-public-fixes Support adr-002 version number scheme.
2 parents d88d0a2 + 9c89436 commit f01f466

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

.github/scripts/release/update-changelog.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ BEGIN {
5353
}
5454
5555
# Capture the repository URL from the first version link
56-
links_section && repo_url == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+\]:/ {
56+
links_section && repo_url == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?\]:/ {
5757
match($0, /(https:\/\/github\.com\/[^\/]+\/[^\/]+)\//, arr)
5858
if (arr[1] != "") {
5959
repo_url = arr[1]
@@ -87,8 +87,8 @@ skip_old_upstream && /^> \*\*Upstream sync:\*\*/ { next }
8787
skip_old_upstream && !/^[[:space:]]*$/ && !/^> \*\*Upstream sync:\*\*/ { skip_old_upstream = 0 }
8888
8989
# Capture the first version link to get the previous version
90-
links_section && first_version_link == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+\]:/ {
91-
match($0, /\[([0-9]+\.[0-9]+\.[0-9]+)\]:/, arr)
90+
links_section && first_version_link == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?\]:/ {
91+
match($0, /\[([0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?)\]:/, arr)
9292
if (arr[1] != "" && repo_url != "") {
9393
first_version_link = arr[1]
9494
# 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]+\]:/ {
100100
# Update existing [Unreleased] link if present
101101
links_section && /^\[Unreleased\]:/ {
102102
# Get the previous version and repo URL from the existing link
103-
match($0, /(https:\/\/github\.com\/[^\/]+\/[^\/]+)\/compare\/v([0-9]+\.[0-9]+\.[0-9]+)\.\.\.HEAD/, arr)
103+
match($0, /(https:\/\/github\.com\/[^\/]+\/[^\/]+)\/compare\/v([0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?)\.\.\.HEAD/, arr)
104104
if (arr[1] != "" && arr[2] != "") {
105105
print "[Unreleased]: " arr[1] "/compare/v" version "...HEAD"
106106
print "[" version "]: " arr[1] "/compare/v" arr[2] "...v" version

.github/workflows/publish-maven.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,18 @@ jobs:
8181
if [ -n "${{ inputs.developmentVersion }}" ]; then
8282
DEV_VERSION="${{ inputs.developmentVersion }}"
8383
else
84-
# Increment patch version and add -SNAPSHOT
85-
IFS='.' read -r MAJOR MINOR PATCH <<< "$RELEASE_VERSION"
84+
# Split version: supports both "0.1.32" and "0.1.32-java.0" formats
85+
# Validate RELEASE_VERSION format explicitly to provide clear errors
86+
if ! echo "$RELEASE_VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?$'; then
87+
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
88+
exit 1
89+
fi
90+
# Extract the base M.M.P portion (before any qualifier)
91+
BASE_VERSION=$(echo "$RELEASE_VERSION" | grep -oE '^[0-9]+\.[0-9]+\.[0-9]+')
92+
QUALIFIER=$(echo "$RELEASE_VERSION" | sed "s|^${BASE_VERSION}||")
93+
IFS='.' read -r MAJOR MINOR PATCH <<< "$BASE_VERSION"
8694
NEXT_PATCH=$((PATCH + 1))
87-
DEV_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}-SNAPSHOT"
95+
DEV_VERSION="${MAJOR}.${MINOR}.${NEXT_PATCH}${QUALIFIER}-SNAPSHOT"
8896
fi
8997
echo "Next development version: $DEV_VERSION"
9098
@@ -109,12 +117,12 @@ jobs:
109117
# Update CHANGELOG.md with release version and upstream sync hash
110118
./.github/scripts/release/update-changelog.sh "${VERSION}" "${UPSTREAM_HASH}"
111119
112-
# Update version in README.md
113-
sed -i "s|<version>[0-9]*\.[0-9]*\.[0-9]*</version>|<version>${VERSION}</version>|g" README.md
114-
sed -i "s|copilot-sdk-java:[0-9]*\.[0-9]*\.[0-9]*|copilot-sdk-java:${VERSION}|g" README.md
120+
# Update version in README.md (supports versions like 1.0.0 and 0.1.32-java.0)
121+
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
122+
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
115123
116124
# Update version in jbang-example.java
117-
sed -i "s|copilot-sdk-java:[0-9]*\.[0-9]*\.[0-9]*|copilot-sdk-java:${VERSION}|g" jbang-example.java
125+
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
118126
119127
# Update version in cookbook files (Maven will filter ${project.version} during site generation,
120128
# but we also need the actual version for direct JBang usage)
@@ -190,7 +198,7 @@ jobs:
190198
191199
# Get the previous tag for generating notes
192200
PREV_TAG=$(git tag --list 'v*' --sort=-version:refname \
193-
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' \
201+
| grep -E '^v[0-9]+\.[0-9]+\.[0-9]+(-java\.[0-9]+)?$' \
194202
| grep -Fxv "${CURRENT_TAG}" \
195203
| head -n 1)
196204

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Snapshot builds of the next development version are published to Maven Central S
6060
### Gradle
6161

6262
```groovy
63-
implementation 'com.github:copilot-sdk-java:0.1.32'
63+
implementation 'com.github:copilot-sdk-java:0.1.32-java.0'
6464
```
6565

6666
## Quick Start

0 commit comments

Comments
 (0)