fix(ci): avoid duplicate agent latest assets

This commit is contained in:
t8y2 committed 2026-07-24 09:37:44 +08:00
1 parent 192d874554
commit 1870be4a81
5 files changed
+134 -33

No files matched your search

+9 -12
View File
@@ -565,27 +565,24 @@ jobs:
git push origin refs/tags/agents-latest --force
if gh release view agents-latest --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
# Versioned driver assets change names every release, so remove the
# previous set before uploading to keep agents-latest unambiguous.
# agents-latest is only the stable registry entry point. Actual artifacts
# stay on the immutable agents-v* release referenced by the registry.
gh release view agents-latest --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name' |
while IFS= read -r asset; do
case "$asset" in
dbx-agent-*.jar|dbx-agent-*.zip|dbx-agent-oracle-*|dbx-agent-xugu-*|dbx-agent-kingbase-*)
gh release delete-asset agents-latest "$asset" --repo "$GITHUB_REPOSITORY" --yes
;;
esac
[ "$asset" = "agent-registry.json" ] && continue
gh release delete-asset agents-latest "$asset" --repo "$GITHUB_REPOSITORY" --yes
done
gh release upload agents-latest release/* --repo "$GITHUB_REPOSITORY" --clobber
gh release upload agents-latest release/agent-registry.json --repo "$GITHUB_REPOSITORY" --clobber
gh release edit agents-latest \
--repo "$GITHUB_REPOSITORY" \
--title "Agents latest" \
--notes "Moving release for the latest DBX agent registry, driver artifacts, managed JRE archives, and offline bundles." \
--notes "Moving entry point for the latest DBX agent registry. Artifacts are stored on the referenced versioned agents release." \
--latest=false
else
gh release create agents-latest release/* \
gh release create agents-latest release/agent-registry.json \
--repo "$GITHUB_REPOSITORY" \
--title "Agents latest" \
--notes "Moving release for the latest DBX agent registry, driver artifacts, managed JRE archives, and offline bundles." \
--notes "Moving entry point for the latest DBX agent registry. Artifacts are stored on the referenced versioned agents release." \
--latest=false
fi
@@ -690,6 +687,6 @@ jobs:
)
# agents-latest is mutable, so its stable asset names must replace the previous release contents.
if [[ "$OVERWRITE_EXISTING" == "true" ]]; then
args+=(--overwrite-existing)
args+=(--overwrite-existing --prune-assets)
fi
node .github/scripts/sync-cnb-release.mjs "${args[@]}"