Fix: release workflow SHA sync to main with error logging
- Remove duplicate TOKEN line - API PUT: log HTTP response code and body on failure - Log warning if file SHA lookup fails Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@@ -378,7 +378,6 @@ jobs:
|
|||||||
VERSION="${{ steps.meta.outputs.version }}"
|
VERSION="${{ steps.meta.outputs.version }}"
|
||||||
CURRENT_BRANCH="${{ github.ref_name }}"
|
CURRENT_BRANCH="${{ github.ref_name }}"
|
||||||
TOKEN="${{ secrets.GA_TOKEN }}"
|
TOKEN="${{ secrets.GA_TOKEN }}"
|
||||||
TOKEN="${{ secrets.GA_TOKEN }}"
|
|
||||||
|
|
||||||
git config --local user.email "gitea-actions[bot]@mokoconsulting.tech"
|
git config --local user.email "gitea-actions[bot]@mokoconsulting.tech"
|
||||||
git config --local user.name "gitea-actions[bot]"
|
git config --local user.name "gitea-actions[bot]"
|
||||||
@@ -402,10 +401,10 @@ jobs:
|
|||||||
"${API}/contents/updates.xml?ref=main" | jq -r '.sha // empty')
|
"${API}/contents/updates.xml?ref=main" | jq -r '.sha // empty')
|
||||||
|
|
||||||
if [ -n "$FILE_SHA" ]; then
|
if [ -n "$FILE_SHA" ]; then
|
||||||
# Base64-encode the updates.xml content
|
# Base64-encode the updates.xml content from working tree (has updated SHA)
|
||||||
CONTENT=$(base64 -w0 updates.xml)
|
CONTENT=$(base64 -w0 updates.xml)
|
||||||
|
|
||||||
curl -sf -X PUT -H "Authorization: token ${GA_TOKEN}" \
|
RESPONSE=$(curl -s -w "\n%{http_code}" -X PUT -H "Authorization: token ${GA_TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"${API}/contents/updates.xml" \
|
"${API}/contents/updates.xml" \
|
||||||
-d "$(jq -n \
|
-d "$(jq -n \
|
||||||
@@ -414,7 +413,16 @@ jobs:
|
|||||||
--arg msg "chore: update ${STABILITY} channel to ${VERSION} on main [skip ci]" \
|
--arg msg "chore: update ${STABILITY} channel to ${VERSION} on main [skip ci]" \
|
||||||
--arg branch "main" \
|
--arg branch "main" \
|
||||||
'{content: $content, sha: $sha, message: $msg, branch: $branch}'
|
'{content: $content, sha: $sha, message: $msg, branch: $branch}'
|
||||||
)" > /dev/null && echo "updates.xml synced to main via API" || echo "WARNING: failed to sync updates.xml to main"
|
)")
|
||||||
|
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
|
||||||
|
if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "201" ]; then
|
||||||
|
echo "updates.xml synced to main via API (HTTP ${HTTP_CODE})"
|
||||||
|
else
|
||||||
|
echo "WARNING: failed to sync updates.xml to main (HTTP ${HTTP_CODE})"
|
||||||
|
echo "$RESPONSE" | head -5
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "WARNING: could not get file SHA for updates.xml on main"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user