diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 381a8d9..618405f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -378,7 +378,6 @@ jobs: VERSION="${{ steps.meta.outputs.version }}" CURRENT_BRANCH="${{ github.ref_name }}" TOKEN="${{ secrets.GA_TOKEN }}" - TOKEN="${{ secrets.GA_TOKEN }}" git config --local user.email "gitea-actions[bot]@mokoconsulting.tech" git config --local user.name "gitea-actions[bot]" @@ -402,10 +401,10 @@ jobs: "${API}/contents/updates.xml?ref=main" | jq -r '.sha // empty') 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) - 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" \ "${API}/contents/updates.xml" \ -d "$(jq -n \ @@ -414,7 +413,16 @@ jobs: --arg msg "chore: update ${STABILITY} channel to ${VERSION} on main [skip ci]" \ --arg branch "main" \ '{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