Skip to content

Commit 91bee47

Browse files
committed
feat: enhance release process to track upstream SDK sync in CHANGELOG and update scripts
1 parent c9a1eea commit 91bee47

4 files changed

Lines changed: 47 additions & 10 deletions

File tree

‎.github/copilot-instructions.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,20 @@ The release process is automated via the `publish-maven.yml` GitHub Actions work
258258
- Converts the `## [Unreleased]` section to `## [version] - date`
259259
- Creates a new empty `## [Unreleased]` section at the top
260260
- Updates version comparison links at the bottom of CHANGELOG.md
261+
- Injects the upstream SDK commit hash (from `.lastmerge`) as a `> **Upstream sync:**` blockquote in both the new `[Unreleased]` section and the released version section
261262

262-
2. **Documentation Updates**: README.md and jbang-example.java are updated with the new version
263+
2. **Upstream Sync Tracking**: Each release records which commit from the official `github/copilot-sdk` it is synced to:
264+
- The `.lastmerge` file is read during the release workflow
265+
- The commit hash is injected into `CHANGELOG.md` under the release heading
266+
- Format: `> **Upstream sync:** [\`github/copilot-sdk@SHORT_HASH\`](link-to-commit)`
263267

264-
3. **Maven Release**: Uses `maven-release-plugin` to:
268+
3. **Documentation Updates**: README.md and jbang-example.java are updated with the new version.
269+
270+
4. **Maven Release**: Uses `maven-release-plugin` to:
265271
- Update pom.xml version
266272
- Create a git tag
267273
- Deploy to Maven Central
268274

269-
4. **Rollback**: If the release fails, the documentation commit is automatically reverted
275+
5. **Rollback**: If the release fails, the documentation commit is automatically reverted
270276

271277
The workflow is triggered manually via workflow_dispatch with optional version parameters.

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,25 @@
22
set -e
33

44
# Script to update CHANGELOG.md during release process
5-
# Usage: ./update-changelog.sh <version>
5+
# Usage: ./update-changelog.sh <version> [upstream-hash]
66
# Example: ./update-changelog.sh 1.0.8
7+
# Example: ./update-changelog.sh 1.0.8 05e3c46c8c23130c9c064dc43d00ec78f7a75eab
78

89
if [ -z "$1" ]; then
910
echo "Error: Version argument required"
10-
echo "Usage: $0 <version>"
11+
echo "Usage: $0 <version> [upstream-hash]"
1112
exit 1
1213
fi
1314

1415
VERSION="$1"
16+
UPSTREAM_HASH="${2:-}"
1517
CHANGELOG_FILE="${CHANGELOG_FILE:-CHANGELOG.md}"
1618
RELEASE_DATE=$(date +%Y-%m-%d)
1719

1820
echo "Updating CHANGELOG.md for version ${VERSION} (${RELEASE_DATE})"
21+
if [ -n "$UPSTREAM_HASH" ]; then
22+
echo " Upstream SDK sync: ${UPSTREAM_HASH:0:7}"
23+
fi
1924

2025
# Check if CHANGELOG.md exists
2126
if [ ! -f "$CHANGELOG_FILE" ]; then
@@ -33,7 +38,7 @@ fi
3338
TEMP_FILE=$(mktemp)
3439

3540
# Process the CHANGELOG
36-
awk -v version="$VERSION" -v date="$RELEASE_DATE" '
41+
awk -v version="$VERSION" -v date="$RELEASE_DATE" -v upstream_hash="$UPSTREAM_HASH" '
3742
BEGIN {
3843
unreleased_found = 0
3944
content_found = 0
@@ -60,12 +65,27 @@ links_section && repo_url == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+\]:/ {
6065
if (!unreleased_found) {
6166
print "## [Unreleased]"
6267
print ""
68+
if (upstream_hash != "") {
69+
short_hash = substr(upstream_hash, 1, 7)
70+
print "> **Upstream sync:** [`github/copilot-sdk@" short_hash "`](https://github.com/github/copilot-sdk/commit/" upstream_hash ")"
71+
print ""
72+
}
6373
print "## [" version "] - " date
74+
if (upstream_hash != "") {
75+
print ""
76+
print "> **Upstream sync:** [`github/copilot-sdk@" short_hash "`](https://github.com/github/copilot-sdk/commit/" upstream_hash ")"
77+
}
6478
unreleased_found = 1
79+
skip_old_upstream = 1
6580
next
6681
}
6782
}
6883
84+
# Skip the old upstream sync line and surrounding blank lines from the previous [Unreleased] section
85+
skip_old_upstream && /^[[:space:]]*$/ { next }
86+
skip_old_upstream && /^> \*\*Upstream sync:\*\*/ { next }
87+
skip_old_upstream && !/^[[:space:]]*$/ && !/^> \*\*Upstream sync:\*\*/ { skip_old_upstream = 0 }
88+
6989
# Capture the first version link to get the previous version
7090
links_section && first_version_link == "" && /^\[[0-9]+\.[0-9]+\.[0-9]+\]:/ {
7191
match($0, /\[([0-9]+\.[0-9]+\.[0-9]+)\]:/, arr)

‎.github/workflows/publish-maven.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,14 @@ jobs:
100100
run: |
101101
VERSION="${{ steps.versions.outputs.release_version }}"
102102
103-
# Update CHANGELOG.md with release version
104-
./.github/scripts/update-changelog.sh "${VERSION}"
103+
# Read the upstream SDK commit hash that this release is synced to
104+
UPSTREAM_HASH=$(cat .lastmerge)
105+
UPSTREAM_SHORT="${UPSTREAM_HASH:0:7}"
106+
UPSTREAM_URL="https://github.com/github/copilot-sdk/commit/${UPSTREAM_HASH}"
107+
echo "Upstream SDK sync: ${UPSTREAM_SHORT} (${UPSTREAM_URL})"
108+
109+
# Update CHANGELOG.md with release version and upstream sync hash
110+
./.github/scripts/update-changelog.sh "${VERSION}" "${UPSTREAM_HASH}"
105111
106112
# Update version in README.md
107113
sed -i "s|<version>[0-9]*\.[0-9]*\.[0-9]*</version>|<version>${VERSION}</version>|g" README.md

‎CHANGELOG.md‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22

33
All notable changes to the Copilot SDK for Java will be documented in this file.
44

5-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6+
7+
> Note: This file is automatically modified by scripts and coding agents. Do not change it manually.
78
89
## [Unreleased]
910

11+
> **Upstream sync:** [`github/copilot-sdk@05e3c46`](https://github.com/github/copilot-sdk/commit/05e3c46c8c23130c9c064dc43d00ec78f7a75eab)
12+
1013
## [1.0.8] - 2026-02-08
1114

15+
> **Upstream sync:** [`github/copilot-sdk@05e3c46`](https://github.com/github/copilot-sdk/commit/05e3c46c8c23130c9c064dc43d00ec78f7a75eab)
16+
1217
### Added
1318

1419
#### ResumeSessionConfig Parity with SessionConfig

0 commit comments

Comments
 (0)