Skip to content

Commit 41fe3e0

Browse files
committed
Fix claude plugin snapshot update
Signed-off-by: BoykoAlex <alex.boyko@broadcom.com>
1 parent 0750cc8 commit 41fe3e0

2 files changed

Lines changed: 39 additions & 20 deletions

File tree

.github/workflows/snapshot-standalone-ls.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
workflow_dispatch:
55
workflow_call:
66

7+
permissions:
8+
contents: write
9+
710
env:
811
AWS_ACCESS_KEY_ID: ${{ secrets.CDN_S3_ACCESS_KEY }}
912
AWS_SECRET_ACCESS_KEY: ${{ secrets.CDN_S3_SECRET_KEY }}
@@ -35,21 +38,45 @@ jobs:
3538
jar_file="spring-boot-language-server-standalone-exec.jar"
3639
s3_path=snapshot/language-server/spring-boot
3740
echo "S3 path: ${s3_path}"
38-
aws s3 rm s3://$AWS_S3_BUCKET/$s3_path/ --recursive
3941
aws s3 cp ./standalone-ls-dist/$jar_file s3://$AWS_S3_BUCKET/$s3_path/$jar_file --no-progress --checksum-algorithm CRC32
42+
- name: Update plugin.json for Snapshot
43+
id: update-plugin
44+
run: |
45+
git config --global user.name "@spring-projects/spring-ide-admin"
46+
git config --global user.email "spring-ide-admin@users.noreply.github.com"
47+
48+
version=$(cat ./standalone-ls-dist/version.txt)
49+
50+
# Create or reset a local branch to the current commit (which is what triggered the action)
51+
git checkout -B claude-snapshot
52+
53+
# Update the version in plugin.json
54+
tmp=$(mktemp)
55+
jq --arg v "$version" '.version = $v' claude-plugins/spring-boot/.claude-plugin/plugin.json > "$tmp" && mv "$tmp" claude-plugins/spring-boot/.claude-plugin/plugin.json
56+
57+
git add claude-plugins/spring-boot/.claude-plugin/plugin.json
58+
git commit -m "Update Claude plugin version to $version"
59+
60+
# Push to the remote claude-snapshot branch forcefully.
61+
# If it doesn't exist, this creates it. If it does exist, it completely overwrites it
62+
# to exactly match the current main + this single version bump commit.
63+
git push origin claude-snapshot --force
64+
65+
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
4066
- name: Update Marketplace JSON
4167
run: |
4268
aws s3 cp s3://$AWS_S3_BUCKET/snapshot/claude-plugins/marketplace.json ./marketplace.json || echo '{"name": "spring-tools-snapshots", "description": "Bleeding-edge snapshot builds for Spring Tools Claude Code plugins.", "owner": {"name": "Spring Tools"}, "plugins": []}' > ./marketplace.json
4369
4470
version=$(cat ./standalone-ls-dist/version.txt)
71+
sha="${{ steps.update-plugin.outputs.sha }}"
4572
4673
tmp=$(mktemp)
4774
jq --arg name "spring-boot" \
4875
--arg version "$version" \
49-
--arg sha "${{ github.sha }}" \
76+
--arg sha "$sha" \
5077
'
5178
.plugins |= if map(.name == $name) | any then
52-
map(if .name == $name then .version=$version | .source.sha=$sha else . end)
79+
map(if .name == $name then .version=$version | .source.sha=$sha | .source.ref="claude-snapshot" else . end)
5380
else
5481
. + [{
5582
"name": $name,
@@ -58,7 +85,7 @@ jobs:
5885
"source": "git-subdir",
5986
"url": "https://github.com/spring-projects/spring-tools.git",
6087
"path": "claude-plugins/spring-boot",
61-
"ref": "main",
88+
"ref": "claude-snapshot",
6289
"sha": $sha
6390
},
6491
"description": "Spring Boot Language Server",

claude-plugins/spring-boot/install.js

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,16 @@ async function downloadFile(url, dest) {
4242
async function install() {
4343
console.error(`Installing Spring Boot Language Server v${version}...`);
4444

45-
// First, try to download the stable release JAR for this version
46-
const releaseUrl = `https://cdn.spring.io/spring-tools/release/language-server/spring-boot/${version}/${JAR_NAME}`;
47-
const snapshotUrl = `https://cdn.spring.io/spring-tools/snapshot/language-server/spring-boot/${JAR_NAME}`;
45+
const isSnapshot = version.includes('-');
46+
const baseUrl = isSnapshot
47+
? `https://cdn.spring.io/spring-tools/snapshot/language-server/spring-boot/${JAR_NAME}`
48+
: `https://cdn.spring.io/spring-tools/release/language-server/spring-boot/${version}/${JAR_NAME}`;
4849

4950
try {
50-
await downloadFile(releaseUrl, jarPath);
51-
console.error(`Successfully installed Release version to ${jarPath}`);
52-
} catch (releaseErr) {
53-
// If the release JAR is not found (e.g. 404 or 403 Access Denied),
54-
// it means this version has not been officially released yet.
55-
// Fallback to downloading the bleeding-edge snapshot!
56-
console.error(`Release JAR not found for v${version}. Falling back to snapshot...`);
57-
try {
58-
await downloadFile(snapshotUrl, jarPath);
59-
console.error(`Successfully installed Snapshot version to ${jarPath}`);
60-
} catch (snapshotErr) {
61-
throw new Error(`Failed to download both Release and Snapshot JARs.\nRelease Error: ${releaseErr.message}\nSnapshot Error: ${snapshotErr.message}`);
62-
}
51+
await downloadFile(baseUrl, jarPath);
52+
console.error(`Successfully installed version ${version} to ${jarPath}`);
53+
} catch (err) {
54+
throw new Error(`Failed to download JAR from ${baseUrl}\nError: ${err.message}`);
6355
}
6456
}
6557

0 commit comments

Comments
 (0)