🐛 fix(ci): 修复脏 driver release 资产导致 revision 错配

This commit is contained in:
Syngnat
2026-06-05 16:10:05 +08:00
parent f7dd90a5d1
commit be26970761
7 changed files with 460 additions and 1 deletions

View File

@@ -71,6 +71,7 @@ jobs:
has_changes: ${{ steps.detect.outputs.has_changes }}
release_source: ${{ steps.detect.outputs.release_source }}
source_commit: ${{ steps.published_source.outputs.source_commit }}
has_manifest: ${{ steps.published_source.outputs.has_manifest }}
steps:
- name: Checkout code
uses: actions/checkout@v5
@@ -84,8 +85,27 @@ jobs:
shell: bash
run: |
set -euo pipefail
SOURCE_COMMIT="$(python3 tools/resolve-driver-release-source.py --repo Syngnat/GoNavi-DriverAgents --tag dev-latest)"
manifest_path="$RUNNER_TEMP/published-driver-manifest.json"
SOURCE_COMMIT="$(python3 tools/resolve-driver-release-source.py --repo Syngnat/GoNavi-DriverAgents --tag dev-latest --manifest-output "$manifest_path")"
echo "source_commit=${SOURCE_COMMIT}" >> "$GITHUB_OUTPUT"
if [[ -s "$manifest_path" ]]; then
echo "has_manifest=true" >> "$GITHUB_OUTPUT"
echo "🧭 Published dev driver release exposes revision manifest"
else
echo "has_manifest=false" >> "$GITHUB_OUTPUT"
echo "🧭 Published dev driver release has no revision manifest"
fi
if [[ -n "$SOURCE_COMMIT" && -s "$manifest_path" ]]; then
if bash ./tools/validate-driver-release-manifest.sh --commit "$SOURCE_COMMIT" --manifest "$manifest_path"; then
echo "manifest_valid=true" >> "$GITHUB_OUTPUT"
echo "🧭 Published dev driver release manifest is consistent with its source commit"
else
echo "manifest_valid=false" >> "$GITHUB_OUTPUT"
echo "⚠️ Published dev driver release manifest is stale; forcing full rebuild"
fi
else
echo "manifest_valid=false" >> "$GITHUB_OUTPUT"
fi
if [[ -n "$SOURCE_COMMIT" ]]; then
echo "🧭 Last published dev driver release source commit: $SOURCE_COMMIT"
else
@@ -123,6 +143,15 @@ jobs:
}
BASE_REF="${{ steps.published_source.outputs.source_commit }}"
HAS_MANIFEST="${{ steps.published_source.outputs.has_manifest }}"
MANIFEST_VALID="${{ steps.published_source.outputs.manifest_valid }}"
if [[ "$HAS_MANIFEST" != "true" ]]; then
echo "⚠️ Published driver release lacks revision manifest; forcing full rebuild to self-heal old assets"
BASE_REF="all"
elif [[ "$MANIFEST_VALID" != "true" ]]; then
echo "⚠️ Published driver release manifest is stale; forcing full rebuild to self-heal old assets"
BASE_REF="all"
fi
if [[ -n "$BASE_REF" ]]; then
if git rev-parse --verify "${BASE_REF}^{commit}" >/dev/null 2>&1 && git merge-base --is-ancestor "$BASE_REF" "$GITHUB_SHA"; then
echo "🧭 Using last published driver release source commit as detection base: $BASE_REF"
@@ -807,6 +836,10 @@ jobs:
exit 0
fi
python3 tools/generate-driver-release-manifest.py \
--assets-dir . \
--output ../driver-release-assets/GoNavi-DriverAgents-Manifest.json
echo "📦 打包驱动总包GoNavi-DriverAgents.zip"
python3 - <<'PY'
import json

View File

@@ -67,12 +67,57 @@ jobs:
has_changes: ${{ steps.detect.outputs.has_changes }}
release_source: ${{ steps.detect.outputs.release_source }}
compare_base: ${{ steps.detect.outputs.compare_base }}
published_source_commit: ${{ steps.published_source.outputs.source_commit }}
has_manifest: ${{ steps.published_source.outputs.has_manifest }}
manifest_valid: ${{ steps.published_source.outputs.manifest_valid }}
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Resolve published driver release source
id: published_source
env:
DRIVER_RELEASE_TOKEN: ${{ secrets.DRIVER_RELEASE_TOKEN }}
shell: bash
run: |
set -euo pipefail
PREV_TAG="$(git describe --tags --match 'v*' --abbrev=0 "${GITHUB_SHA}^" 2>/dev/null || true)"
manifest_path="$RUNNER_TEMP/published-driver-manifest.json"
if [[ -z "$PREV_TAG" ]]; then
echo "source_commit=" >> "$GITHUB_OUTPUT"
echo "has_manifest=false" >> "$GITHUB_OUTPUT"
echo "manifest_valid=false" >> "$GITHUB_OUTPUT"
echo "🧭 No previous stable tag found; full rebuild will be used"
exit 0
fi
SOURCE_COMMIT="$(python3 tools/resolve-driver-release-source.py --repo Syngnat/GoNavi-DriverAgents --tag "$PREV_TAG" --manifest-output "$manifest_path")"
echo "source_commit=${SOURCE_COMMIT}" >> "$GITHUB_OUTPUT"
if [[ -s "$manifest_path" ]]; then
echo "has_manifest=true" >> "$GITHUB_OUTPUT"
echo "🧭 Published driver release exposes revision manifest"
else
echo "has_manifest=false" >> "$GITHUB_OUTPUT"
echo "🧭 Published driver release has no revision manifest"
fi
if [[ -n "$SOURCE_COMMIT" && -s "$manifest_path" ]]; then
if bash ./tools/validate-driver-release-manifest.sh --commit "$SOURCE_COMMIT" --manifest "$manifest_path"; then
echo "manifest_valid=true" >> "$GITHUB_OUTPUT"
echo "🧭 Published driver release manifest is consistent with its source commit"
else
echo "manifest_valid=false" >> "$GITHUB_OUTPUT"
echo "⚠️ Published driver release manifest is stale; forcing full rebuild"
fi
else
echo "manifest_valid=false" >> "$GITHUB_OUTPUT"
fi
if [[ -n "$SOURCE_COMMIT" ]]; then
echo "🧭 Last published release source commit (${PREV_TAG}): $SOURCE_COMMIT"
else
echo "🧭 Unable to resolve published release source commit for ${PREV_TAG}; fallback to previous tag diff"
fi
- name: Detect changed driver agents
id: detect
shell: bash
@@ -112,6 +157,17 @@ jobs:
BASE_REF="all"
RELEASE_SOURCE="all"
fi
HAS_MANIFEST="${{ steps.published_source.outputs.has_manifest }}"
MANIFEST_VALID="${{ steps.published_source.outputs.manifest_valid }}"
if [[ "$RELEASE_SOURCE" != "all" && "$HAS_MANIFEST" != "true" ]]; then
echo "⚠️ Published driver release lacks revision manifest; forcing full rebuild to self-heal old assets"
BASE_REF="all"
RELEASE_SOURCE="all"
elif [[ "$RELEASE_SOURCE" != "all" && "$MANIFEST_VALID" != "true" ]]; then
echo "⚠️ Published driver release manifest is stale; forcing full rebuild to self-heal old assets"
BASE_REF="all"
RELEASE_SOURCE="all"
fi
DRIVERS="$(bash ./tools/detect-changed-driver-agents.sh --base "$BASE_REF" --head "$GITHUB_SHA")"
if [[ "$BASE_REF" != "all" ]]; then
REVISION_DRIVERS=""
@@ -837,6 +893,10 @@ jobs:
exit 0
fi
python3 tools/generate-driver-release-manifest.py \
--assets-dir . \
--output ../driver-release-assets/GoNavi-DriverAgents-Manifest.json
echo "📦 打包驱动总包GoNavi-DriverAgents.zip"
python3 - <<'PY'
import json