Skip to content

Commit f147ac5

Browse files
authored
Merge pull request #211 from mercyblitz/dev-1.x
Refactor CI workflows and update dependencies
2 parents 7eaad56 + 93f4719 commit f147ac5

8 files changed

Lines changed: 95 additions & 14 deletions

File tree

.github/workflows/maven-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ubuntu-latest
2323
strategy:
2424
matrix:
25-
java: [ '8', '11' , '17' , '21' ,' 25' ]
25+
java: [ '8' , '11' , '17' , '21' , '25' ]
2626
maven-profile-spring-framework: [
2727
'spring-framework-5.3' , 'spring-framework-5.2', 'spring-framework-5.1' , 'spring-framework-5.0' ,
2828
'spring-framework-4.3'

.github/workflows/maven-publish.yml

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
needs: build
6868
permissions:
6969
contents: write
70+
models: read
7071
steps:
7172
- name: Checkout Source
7273
uses: actions/checkout@v5
@@ -84,14 +85,90 @@ jobs:
8485
git push origin ${{ inputs.revision }}
8586
fi
8687
88+
- name: Generate Release Notes with Copilot
89+
env:
90+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
run: |
92+
CURRENT_TAG="${{ inputs.revision }}"
93+
94+
# Find the previous tag (the one before the current tag)
95+
PREV_TAG=$(git describe --tags --abbrev=0 --exclude="${CURRENT_TAG}" HEAD 2>/dev/null || echo "")
96+
97+
# Collect commits between the previous tag and HEAD
98+
if [ -n "$PREV_TAG" ]; then
99+
COMMITS=$(git log --oneline "${PREV_TAG}..HEAD" 2>/dev/null || echo "No commits found")
100+
SINCE_LABEL="$PREV_TAG"
101+
else
102+
COMMITS=$(git log --oneline -50 2>/dev/null || echo "No commits found")
103+
SINCE_LABEL="the beginning"
104+
fi
105+
106+
# Export for Python (avoids shell-escaping issues with multiline content)
107+
export CURRENT_TAG_DATA="$CURRENT_TAG"
108+
export PREV_TAG_DATA="$SINCE_LABEL"
109+
export COMMITS_DATA="$COMMITS"
110+
111+
# Call GitHub Copilot via GitHub Models API and capture the summary
112+
SUMMARY=$(python3 << 'PYEOF'
113+
import json, os, urllib.request, sys
114+
115+
current_tag = os.environ['CURRENT_TAG_DATA']
116+
prev_tag = os.environ['PREV_TAG_DATA']
117+
commits = os.environ['COMMITS_DATA']
118+
token = os.environ['GH_TOKEN']
119+
120+
prompt = (
121+
f"Generate concise release notes for version {current_tag}.\n\n"
122+
f"Commits since {prev_tag}:\n{commits}\n\n"
123+
"Format the output as markdown with sections for New Features, Bug Fixes, "
124+
"and Other Changes (only include sections that have relevant commits). "
125+
"Be concise and clear."
126+
)
127+
128+
payload = json.dumps({
129+
"model": "gpt-4o",
130+
"messages": [{"role": "user", "content": prompt}]
131+
}).encode()
132+
133+
req = urllib.request.Request(
134+
"https://models.inference.ai.azure.com/chat/completions",
135+
data=payload,
136+
headers={
137+
"Content-Type": "application/json",
138+
"Authorization": f"Bearer {token}"
139+
}
140+
)
141+
142+
try:
143+
with urllib.request.urlopen(req) as resp:
144+
data = json.loads(resp.read())
145+
print(data["choices"][0]["message"]["content"])
146+
except Exception as e:
147+
print(f"Failed to generate summary via Copilot: {e}", file=sys.stderr)
148+
print(f"_Release notes generation failed. Raw commits since {prev_tag}:_\n\n```\n{commits}\n```")
149+
PYEOF
150+
)
151+
152+
# Append the summary (with version header) to release-notes.md
153+
NOTES_FILE="release-notes.md"
154+
if [ ! -f "$NOTES_FILE" ]; then
155+
printf "# Release Notes\n\n" > "$NOTES_FILE"
156+
fi
157+
printf "## v%s\n\n%s\n\n" "$CURRENT_TAG" "$SUMMARY" >> "$NOTES_FILE"
158+
159+
# Write the current release notes to a temp file for the Create Release step
160+
printf "%s" "$SUMMARY" > /tmp/current-release-notes.md
161+
162+
echo "Release notes generated and appended to $NOTES_FILE"
163+
87164
- name: Create Release
88165
run: |
89166
if gh release view "v${{ inputs.revision }}" >/dev/null 2>&1; then
90167
echo "Release v${{ inputs.revision }} already exists, skipping."
91168
else
92-
gh release create v${{ inputs.revision }} \
169+
gh release create ${{ inputs.revision }} \
93170
--title "v${{ inputs.revision }}" \
94-
--generate-notes \
171+
--notes-file /tmp/current-release-notes.md \
95172
--latest
96173
fi
97174
env:
@@ -112,7 +189,7 @@ jobs:
112189
run: |
113190
git config user.name "github-actions[bot]"
114191
git config user.email "github-actions[bot]@users.noreply.github.com"
115-
git add pom.xml
192+
git add pom.xml release-notes.md
116193
git diff --cached --quiet && echo "No changes to commit" || \
117194
git commit -m "chore: bump version to next patch after publishing ${{ inputs.revision }}" && git push
118195

microsphere-spring-context/src/main/java/io/microsphere/spring/context/event/BeanListeners.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ private void iterate(String beanName, Consumer<BeanListener> listenerConsumer, S
170170
}
171171
}
172172
} catch (Throwable e) {
173-
logger.error("BeanEventListener[name : '{}' , bean : '{}', order : {}] execution {} -> '{}' failed", listenerBeanName, listener, i, beanName, action, e);
173+
if (logger.isErrorEnabled()) {
174+
logger.error("BeanEventListener[name : '{}' , bean : '{}', order : {}] execution {} -> '{}' failed", listenerBeanName, listener, i, beanName, action, e);
175+
}
174176
}
175177
}
176178
}

microsphere-spring-context/src/main/java/io/microsphere/spring/context/event/DependencyAnalysisBeanFactoryListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private List<BeanDefinitionHolder> getNonLazyInitSingletonMergedBeanDefinitionHo
358358
for (int i = 0; i < beansCount; i++) {
359359
String beanName = beanNames[i];
360360
if (beanFactory.containsSingleton(beanName)) {
361-
if(logger.isTraceEnabled()) {
361+
if (logger.isTraceEnabled()) {
362362
logger.trace("The Bean[name : '{}'] is ready", beanName);
363363
}
364364
continue;

microsphere-spring-context/src/main/java/io/microsphere/spring/context/event/InterceptingApplicationEventMulticasterProxy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import java.util.concurrent.Executor;
3939
import java.util.function.Predicate;
4040

41+
import static io.microsphere.annotation.ConfigurationProperty.APPLICATION_SOURCE;
4142
import static io.microsphere.collection.MapUtils.newLinkedHashMap;
4243
import static io.microsphere.concurrent.ExecutorUtils.shutdownOnExit;
4344
import static io.microsphere.reflect.MethodUtils.findDeclaredMethod;
@@ -72,7 +73,8 @@ public class InterceptingApplicationEventMulticasterProxy extends GenericBeanPos
7273
*/
7374
@ConfigurationProperty(
7475
defaultValue = DEFAULT_RESET_BEAN_NAME,
75-
description = "The property name of the reset bean name of ApplicationEventMulticaster"
76+
description = "The property name of the reset bean name of ApplicationEventMulticaster",
77+
source = APPLICATION_SOURCE
7678
)
7779
public static final String RESET_BEAN_NAME_PROPERTY_NAME = "microsphere.spring.application-event-multicaster.reset-bean-name";
7880

microsphere-spring-context/src/main/java/io/microsphere/spring/context/lifecycle/LoggingSmartLifecycle.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ public class LoggingSmartLifecycle extends AbstractSmartLifecycle {
7878

7979
@Override
8080
protected void doStart() {
81-
if (logger.isDebugEnabled()) {
82-
logger.debug("doStart()...");
81+
if (logger.isInfoEnabled()) {
82+
logger.info("doStart()...");
8383
}
8484
}
8585

8686
@Override
8787
protected void doStop() {
88-
if (logger.isDebugEnabled()) {
89-
logger.debug("doStop()...");
88+
if (logger.isInfoEnabled()) {
89+
logger.info("doStop()...");
9090
}
9191
}
9292
}

microsphere-spring-parent/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<description>Microsphere Spring Parent</description>
2020

2121
<properties>
22-
<microsphere-java.version>0.2.6</microsphere-java.version>
23-
<microsphere-logging.version>0.1.5</microsphere-logging.version>
22+
<microsphere-java.version>0.2.8</microsphere-java.version>
23+
<microsphere-logging.version>0.1.6</microsphere-logging.version>
2424
<jackson.version>2.21.2</jackson.version>
2525
<snakeyaml.version>2.6</snakeyaml.version>
2626
<p6spy.version>3.9.1</p6spy.version>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.github.microsphere-projects</groupId>
77
<artifactId>microsphere-build</artifactId>
8-
<version>0.2.6</version>
8+
<version>0.2.7</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

0 commit comments

Comments
 (0)