Skip to content

Commit c9436c4

Browse files
committed
Rework
Signed-off-by: BoykoAlex <alex.boyko@broadcom.com>
1 parent 3a6d77c commit c9436c4

4 files changed

Lines changed: 72 additions & 173 deletions

File tree

.github/scripts/generate-prerelease-changelog.sh

Lines changed: 31 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,16 @@ fi
2424
RAW_NAME=${EXTENSION_ID#vscode-}
2525
PREFIX_NAME=$(echo "$RAW_NAME" | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1' FS="-" OFS=" ")
2626

27-
# Function to determine the date of the previous change we should consider
27+
# Function to determine the date of the previous major/minor release
2828
get_last_update_date() {
29-
local date_changelog=""
30-
local date_tag=""
31-
local final_date=""
32-
33-
# 1. Find the last commit that modified the CHANGELOG_FILE with a commit message starting with "Update pre-release changelog"
34-
date_changelog=$(git log -1 --grep="^Update pre-release changelog" --format="%aI" -- "$CHANGELOG_FILE")
35-
36-
# 2. Find the latest git tag that starts with the extension ID (skipping non-zero patch versions)
29+
# 1. Find the latest git tag that starts with the extension ID (skipping non-zero patch versions)
3730
local latest_tag=$(git tag -l "${EXTENSION_ID}-*" --sort=-v:refname | grep -E "^${EXTENSION_ID}-[0-9]+\.[0-9]+\.0(-|$)" | head -n 1)
3831
if [ -n "$latest_tag" ]; then
39-
date_tag=$(git log -1 --format="%aI" "$latest_tag")
40-
fi
41-
42-
# 3. If both are present, use the later of the dates
43-
if [ -n "$date_changelog" ] && [ -n "$date_tag" ]; then
44-
# Use node to compare ISO 8601 dates reliably across platforms
45-
local later_date=$(node -e "console.log(new Date('$date_changelog') > new Date('$date_tag') ? '$date_changelog' : '$date_tag')")
46-
final_date="$later_date"
47-
elif [ -n "$date_changelog" ]; then
48-
final_date="$date_changelog"
49-
elif [ -n "$date_tag" ]; then
50-
final_date="$date_tag"
51-
fi
52-
53-
if [ -n "$final_date" ]; then
54-
echo "$final_date"
32+
git log -1 --format="%aI" "$latest_tag"
5533
return
5634
fi
5735

58-
# 4. If there are no dates, use VSCode Marketplace
36+
# 2. If no tag, use VSCode Marketplace
5937
local publisher=$(jq -r '.publisher' "$PACKAGE_JSON")
6038
if [ -n "$publisher" ] && [ "$publisher" != "null" ]; then
6139
echo "Querying VSCode Marketplace for the last non-prerelease version of ${publisher}.${EXTENSION_ID}..." >&2
@@ -67,7 +45,7 @@ get_last_update_date() {
6745
fi
6846
fi
6947

70-
# 5. Still no dates? Keep date blank
48+
# 3. Still no dates? Keep date blank
7149
echo ""
7250
}
7351

@@ -98,73 +76,48 @@ update_changelog() {
9876
local formatted_issues="$1"
9977
local version=$(jq -r '.version' "$PACKAGE_JSON")
10078
local current_date=$(date +"%Y-%m-%d")
101-
local header="## $current_date ($version PRE-RELEASE)"
79+
local new_header="## $current_date ($version PRE-RELEASE)"
10280

10381
local temp_file=$(mktemp)
10482

105-
# Check if the exact header already exists in the file
106-
if grep -q "^$header$" "$CHANGELOG_FILE"; then
107-
echo "Pre-release section for $current_date ($version PRE-RELEASE) already exists. Prepending new issues." >&2
108-
109-
# Find the line number of the header
110-
local header_line=$(grep -n "^$header$" "$CHANGELOG_FILE" | cut -d: -f1)
111-
112-
# Find the line number of the "#### all fixes and improvements in detail" that comes after the header
113-
local details_offset=$(tail -n +$header_line "$CHANGELOG_FILE" | grep -n "^#### all fixes and improvements in detail$" | head -n 1 | cut -d: -f1)
114-
115-
if [ -n "$details_offset" ]; then
116-
local insert_line=$((header_line + details_offset))
117-
118-
# Copy everything up to the insert line
119-
head -n "$insert_line" "$CHANGELOG_FILE" > "$temp_file"
120-
echo "" >> "$temp_file"
121-
# Insert the new issues
122-
echo "$formatted_issues" >> "$temp_file"
123-
124-
# Copy the rest of the file, skipping the blank line immediately following if it exists
125-
tail -n +$((insert_line + 1)) "$CHANGELOG_FILE" | awk 'NR==1 && /^$/ {next} {print}' >> "$temp_file"
126-
else
127-
# Fallback if "#### all fixes and improvements in detail" is missing under the header
128-
head -n "$header_line" "$CHANGELOG_FILE" > "$temp_file"
129-
echo "" >> "$temp_file"
130-
echo "#### all fixes and improvements in detail" >> "$temp_file"
131-
echo "" >> "$temp_file"
132-
echo "$formatted_issues" >> "$temp_file"
133-
echo "" >> "$temp_file"
134-
tail -n +$((header_line + 1)) "$CHANGELOG_FILE" >> "$temp_file"
135-
fi
83+
# Check if a header for this pre-release version already exists (ignoring the exact date)
84+
local existing_header=$(grep -E "^## .* \($version PRE-RELEASE\)$" "$CHANGELOG_FILE" | head -n 1)
85+
86+
if [ -n "$existing_header" ]; then
87+
echo "Pre-release section for $version already exists. Overwriting issues." >&2
88+
local header_line=$(grep -n -F "$existing_header" "$CHANGELOG_FILE" | cut -d: -f1)
89+
local next_header_offset=$(tail -n +$((header_line + 1)) "$CHANGELOG_FILE" | grep -n "^## " | head -n 1 | cut -d: -f1)
13690

137-
# Deduplicate issues in the section we just modified
138-
local next_header_offset=$(tail -n +$((header_line + 1)) "$temp_file" | grep -n "^## " | head -n 1 | cut -d: -f1)
13991
local end_line
140-
14192
if [ -n "$next_header_offset" ]; then
14293
end_line=$((header_line + next_header_offset - 1))
14394
else
144-
end_line=$(wc -l < "$temp_file")
95+
end_line=$(wc -l < "$CHANGELOG_FILE")
14596
fi
14697

147-
local dedup_temp=$(mktemp)
148-
149-
# 1. Copy everything before the issues section
150-
head -n "$insert_line" "$temp_file" > "$dedup_temp"
151-
echo "" >> "$dedup_temp"
98+
# Copy everything before the header
99+
if [ "$header_line" -gt 1 ]; then
100+
head -n $((header_line - 1)) "$CHANGELOG_FILE" > "$temp_file"
101+
else
102+
> "$temp_file"
103+
fi
152104

153-
# 2. Extract, deduplicate, and append the issues section
154-
sed -n "$((insert_line + 1)),${end_line}p" "$temp_file" | awk '!seen[$0]++' | grep -v "^$" >> "$dedup_temp"
155-
echo "" >> "$dedup_temp"
105+
# Insert the new header (with current date) and issues
106+
echo "$new_header" >> "$temp_file"
107+
echo "" >> "$temp_file"
108+
echo "#### all fixes and improvements in detail" >> "$temp_file"
109+
echo "" >> "$temp_file"
110+
echo "$formatted_issues" >> "$temp_file"
111+
echo "" >> "$temp_file"
156112

157-
# 3. Copy everything after the issues section
113+
# Copy everything after the old section
158114
if [ -n "$next_header_offset" ]; then
159-
tail -n +$((end_line + 1)) "$temp_file" >> "$dedup_temp"
115+
tail -n +$((end_line + 1)) "$CHANGELOG_FILE" >> "$temp_file"
160116
fi
161-
162-
mv "$dedup_temp" "$temp_file"
163-
164117
else
165118
echo "Creating new pre-release section for $current_date ($version PRE-RELEASE)." >&2
166119
# Prepend the new header and the formatted list of issues to CHANGELOG.md
167-
echo "$header" > "$temp_file"
120+
echo "$new_header" > "$temp_file"
168121
echo "" >> "$temp_file"
169122
echo "#### all fixes and improvements in detail" >> "$temp_file"
170123
echo "" >> "$temp_file"
@@ -187,4 +140,4 @@ if [ -z "$FORMATTED_ISSUES" ]; then
187140
exit 0
188141
fi
189142

190-
update_changelog "$FORMATTED_ISSUES"
143+
update_changelog "$FORMATTED_ISSUES"

.github/workflows/publish-vscode-extension-pre-release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,21 @@ jobs:
8686
# Retry loop for git push to handle parallel workflow conflicts
8787
max_retries=5
8888
retry_count=0
89+
90+
# Get current branch name
91+
CURRENT_BRANCH=$(git branch --show-current)
92+
if [ -z "$CURRENT_BRANCH" ]; then
93+
# If in detached HEAD (like actions/checkout often is), we push to the ref that triggered the workflow
94+
CURRENT_BRANCH=${GITHUB_REF#refs/heads/}
95+
fi
96+
8997
while [ $retry_count -lt $max_retries ]; do
90-
if git push; then
98+
if git push origin HEAD:$CURRENT_BRANCH; then
9199
echo "Successfully pushed changelog updates."
92100
break
93101
else
94102
echo "Push failed, attempting to pull and rebase (attempt $((retry_count + 1)) of $max_retries)..."
95-
git pull --rebase origin main
103+
git pull --rebase origin $CURRENT_BRANCH
96104
retry_count=$((retry_count + 1))
97105
# Add a small random sleep to prevent perfectly synced retries
98106
sleep $((RANDOM % 5 + 1))

.github/workflows/update-vscode-extension-pre-release-changelog.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

vscode-extensions/vscode-spring-boot/CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
## 2026-05-12 (2.2.0 PRE-RELEASE)
2+
3+
#### all fixes and improvements in detail
4+
5+
* _(Spring Boot)_ "Internal error" logged by Spring Boot Language Server [#1886](https://github.com/spring-projects/spring-tools/issues/1886)
6+
* _(Spring Boot)_ [API Versioning] Spring Language Server Doesn't Recognise useVersionResolver() use for API Versioning [#1880](https://github.com/spring-projects/spring-tools/issues/1880)
7+
* _(Spring Boot)_ [aot repositories] align position of code lens with method declaration or annotation, not above the javadoc [#1874](https://github.com/spring-projects/spring-tools/issues/1874)
8+
* _(Spring Boot)_ allow validation preferences to include parameter values for the validation [#1869](https://github.com/spring-projects/spring-tools/issues/1869)
9+
* _(Spring Boot)_ [cleanup] remove outdated vscode ai agent definitions and code from extension [#1868](https://github.com/spring-projects/spring-tools/issues/1868)
10+
* _(Spring Boot)_ Use JDT Refactoring instead OpenRewrite recipe for AOT generated query [#1865](https://github.com/spring-projects/spring-tools/issues/1865)
11+
* _(Spring Boot)_ [type-safe property references] deal with multiple references at once [#1860](https://github.com/spring-projects/spring-tools/issues/1860)
12+
* _(Spring Boot)_ [spring ai] add overall support for Spring AI [#1857](https://github.com/spring-projects/spring-tools/issues/1857)
13+
* _(Spring Boot)_ improve spring data query symbol label for multi-line text-block queries [#1856](https://github.com/spring-projects/spring-tools/issues/1856)
14+
* _(Spring Boot)_ NPE thrown inside of updated indexer logic [#1855](https://github.com/spring-projects/spring-tools/issues/1855)
15+
* _(Spring Boot)_ Native query validation defaults to PostgreSQL when MariaDB and H2 driver in class path [#1839](https://github.com/spring-projects/spring-tools/issues/1839)
16+
* _(Spring Boot)_ [spring indexer] remove deprecated symbol indexing [#1836](https://github.com/spring-projects/spring-tools/issues/1836)
17+
* _(Spring Boot)_ AOT Query escape chars [#1833](https://github.com/spring-projects/spring-tools/issues/1833)
18+
* _(Spring Boot)_ Spring Boot Tools [#1831](https://github.com/spring-projects/spring-tools/issues/1831)
19+
* _(Spring Boot)_ auto completion of bean names for `@DependsOn` annotation is broken [#1829](https://github.com/spring-projects/spring-tools/issues/1829)
20+
* _(Spring Boot)_ [type-safe property references] support refactoring string-based to type-safe property references [#1827](https://github.com/spring-projects/spring-tools/issues/1827)
21+
* _(Spring Boot)_ additional Spring indexer refactorings [#1825](https://github.com/spring-projects/spring-tools/issues/1825)
22+
* _(Spring Boot)_ improve JDK 25 AOT cache usage [#1824](https://github.com/spring-projects/spring-tools/issues/1824)
23+
* _(Spring Boot)_ [structure view] sorting of projects get out of sync when projects arrive async [#1821](https://github.com/spring-projects/spring-tools/issues/1821)
24+
* _(Spring Boot)_ revalidation of OpenFeign config clients does not work all the time [#1804](https://github.com/spring-projects/spring-tools/issues/1804)
25+
* _(Spring Boot)_ [structure view] initial delay when opening the view [#1690](https://github.com/spring-projects/spring-tools/issues/1690)
26+
* _(Spring Boot)_ [validation] more false positives for missing configuration validation [#1292](https://github.com/spring-projects/spring-tools/issues/1292)
27+
* _(Spring Boot)_ Support `@ConfigurationProperties` on bean method for `application.properties` references [#1256](https://github.com/spring-projects/spring-tools/issues/1256)
28+
* _(Spring Boot)_ couldn't create connection to server [#1167](https://github.com/spring-projects/spring-tools/issues/1167)
29+
* _(Spring Boot)_ Only shows when springboot app runs [#1136](https://github.com/spring-projects/spring-tools/issues/1136)
30+
* _(Spring Boot)_ CorruptZip: end of central directory record signature not found [#1102](https://github.com/spring-projects/spring-tools/issues/1102)
31+
132
## 2026-03-18 (5.1.1 RELEASE, incl. language servers version 2.1.1)
233

334
#### all fixes and improvements in detail

0 commit comments

Comments
 (0)