Skip to content

Commit 8ebc44c

Browse files
authored
Merge pull request #18 from mercyblitz/dev-1.x
Update Maven wrapper, enhance workflows, and sync README versions
2 parents 37e913b + 0050c6d commit 8ebc44c

4 files changed

Lines changed: 90 additions & 9 deletions

File tree

.github/workflows/maven-build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
name: Maven Build
1010

11+
permissions:
12+
contents: read
13+
1114
on:
1215
push:
1316
branches: [ 'dev-1.x' ]

.github/workflows/maven-publish.yml

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ on:
2121
jobs:
2222
build:
2323
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
2426
if: ${{ inputs.revision }}
2527
steps:
2628
- name: Validate version format
2729
run: |
2830
if ! echo "${{ inputs.revision }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
29-
echo "Error: version '${{ inputs.revision }}' does not match the required pattern major.minor.patch"
30-
exit 1
31+
echo "Error: version '${{ inputs.revision }}' does not match the required pattern major.minor.patch"
32+
exit 1
3133
fi
3234
3335
- name: Checkout Source
@@ -59,12 +61,12 @@ jobs:
5961
SIGN_KEY: ${{ secrets.OSS_SIGNING_KEY }}
6062
SIGN_KEY_PASS: ${{ secrets.OSS_SIGNING_PASSWORD }}
6163

62-
6364
release:
6465
runs-on: ubuntu-latest
6566
needs: build
6667
permissions:
6768
contents: write
69+
models: read
6870
steps:
6971
- name: Checkout Source
7072
uses: actions/checkout@v5
@@ -82,14 +84,90 @@ jobs:
8284
git push origin ${{ inputs.revision }}
8385
fi
8486
87+
- name: Generate Release Notes with Copilot
88+
env:
89+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
run: |
91+
CURRENT_TAG="${{ inputs.revision }}"
92+
93+
# Find the previous tag (the one before the current tag)
94+
PREV_TAG=$(git describe --tags --abbrev=0 --exclude="${CURRENT_TAG}" HEAD 2>/dev/null || echo "")
95+
96+
# Collect commits between the previous tag and HEAD
97+
if [ -n "$PREV_TAG" ]; then
98+
COMMITS=$(git log --oneline "${PREV_TAG}..HEAD" 2>/dev/null || echo "No commits found")
99+
SINCE_LABEL="$PREV_TAG"
100+
else
101+
COMMITS=$(git log --oneline -50 2>/dev/null || echo "No commits found")
102+
SINCE_LABEL="the beginning"
103+
fi
104+
105+
# Export for Python (avoids shell-escaping issues with multiline content)
106+
export CURRENT_TAG_DATA="$CURRENT_TAG"
107+
export PREV_TAG_DATA="$SINCE_LABEL"
108+
export COMMITS_DATA="$COMMITS"
109+
110+
# Call GitHub Copilot via GitHub Models API and capture the summary
111+
SUMMARY=$(python3 << 'PYEOF'
112+
import json, os, urllib.request, sys
113+
114+
current_tag = os.environ['CURRENT_TAG_DATA']
115+
prev_tag = os.environ['PREV_TAG_DATA']
116+
commits = os.environ['COMMITS_DATA']
117+
token = os.environ['GH_TOKEN']
118+
119+
prompt = (
120+
f"Generate concise release notes for version {current_tag}.\n\n"
121+
f"Commits since {prev_tag}:\n{commits}\n\n"
122+
"Format the output as markdown with sections for New Features, Bug Fixes, "
123+
"and Other Changes (only include sections that have relevant commits). "
124+
"Be concise and clear."
125+
)
126+
127+
payload = json.dumps({
128+
"model": "gpt-4o",
129+
"messages": [{"role": "user", "content": prompt}]
130+
}).encode()
131+
132+
req = urllib.request.Request(
133+
"https://models.inference.ai.azure.com/chat/completions",
134+
data=payload,
135+
headers={
136+
"Content-Type": "application/json",
137+
"Authorization": f"Bearer {token}"
138+
}
139+
)
140+
141+
try:
142+
with urllib.request.urlopen(req) as resp:
143+
data = json.loads(resp.read())
144+
print(data["choices"][0]["message"]["content"])
145+
except Exception as e:
146+
print(f"Failed to generate summary via Copilot: {e}", file=sys.stderr)
147+
print(f"_Release notes generation failed. Raw commits since {prev_tag}:_\n\n```\n{commits}\n```")
148+
PYEOF
149+
)
150+
151+
# Append the summary (with version header) to release-notes.md
152+
NOTES_FILE="release-notes.md"
153+
if [ ! -f "$NOTES_FILE" ]; then
154+
printf "# Release Notes\n\n" > "$NOTES_FILE"
155+
fi
156+
printf "## v%s\n\n%s\n\n" "$CURRENT_TAG" "$SUMMARY" >> "$NOTES_FILE"
157+
158+
# Write the current release notes to a temp file for the Create Release step
159+
printf "%s" "$SUMMARY" > /tmp/current-release-notes.md
160+
161+
echo "Release notes generated and appended to $NOTES_FILE"
162+
85163
- name: Create Release
86164
run: |
87165
if gh release view "v${{ inputs.revision }}" >/dev/null 2>&1; then
88166
echo "Release v${{ inputs.revision }} already exists, skipping."
89167
else
90-
gh release create v${{ inputs.revision }} \
168+
gh release create ${{ inputs.revision }} \
91169
--title "v${{ inputs.revision }}" \
92-
--generate-notes \
170+
--notes-file /tmp/current-release-notes.md \
93171
--latest
94172
fi
95173
env:
@@ -110,7 +188,7 @@ jobs:
110188
run: |
111189
git config user.name "github-actions[bot]"
112190
git config user.email "github-actions[bot]@users.noreply.github.com"
113-
git add pom.xml
191+
git add pom.xml release-notes.md
114192
git diff --cached --quiet && echo "No changes to commit" || \
115193
git commit -m "chore: bump version to next patch after publishing ${{ inputs.revision }}" && git push
116194
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
wrapperVersion=3.3.4
22
distributionType=only-script
3-
distributionUrl=https://maven.aliyun.com/repository/public/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
3+
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.9.15/apache-maven-3.9.15-bin.zip

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ pom.xml:
6060

6161
| **Branches** | **Purpose** | **Latest Version** |
6262
|--------------|---------------------------------------------|--------------------|
63-
| **0.2.x** | Compatible with Gateway 2022.0.x - 2025.0.x | 0.2.1 |
64-
| **0.1.x** | Compatible with Gateway Hoxton - 2021.0.x | 0.1.1 |
63+
| **0.2.x** | Compatible with Gateway 2022.0.x - 2025.0.x | 0.2.3 |
64+
| **0.1.x** | Compatible with Gateway Hoxton - 2021.0.x | 0.1.3 |
6565

6666
Then add the specific modules you need:
6767

0 commit comments

Comments
 (0)