On branch edburns/dd-2794379-cosmetic-post-public-fixes Support adr-002 version number scheme. by edburns · Pull Request #11 · github/copilot-sdk-java · GitHub
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
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"
Comment thread
edburns marked this conversation as resolved.
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
Loading