workflow: improve Gitea release workflow with enhanced error handling and debug outputs
This commit is contained in:
parent
946202de0e
commit
5f6fef9448
39
.github/workflows/gitea-release.yml
vendored
39
.github/workflows/gitea-release.yml
vendored
@ -102,12 +102,19 @@ jobs:
|
|||||||
GITEA_REPO: ${{ steps.gitea_url.outputs.GITEA_REPO }}
|
GITEA_REPO: ${{ steps.gitea_url.outputs.GITEA_REPO }}
|
||||||
GITEA_OWNER: ${{ steps.gitea_url.outputs.GITEA_OWNER }}
|
GITEA_OWNER: ${{ steps.gitea_url.outputs.GITEA_OWNER }}
|
||||||
run: |
|
run: |
|
||||||
|
# Debug Token (nur Länge ausgeben für Sicherheit)
|
||||||
|
echo "Debug: Token length: ${#GITEA_TOKEN}"
|
||||||
|
if [ -z "$GITEA_TOKEN" ]; then
|
||||||
|
echo "Error: GITEA_TOKEN is empty"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||||
cd .pio/build/esp32dev
|
cd .pio/build/esp32dev
|
||||||
|
|
||||||
# Debug-Ausgaben
|
# Debug-Ausgaben
|
||||||
echo "Debug: Checking API URL..."
|
echo "Debug: API URL: ${GITEA_API_URL}"
|
||||||
echo "GITEA_API_URL=${GITEA_API_URL}"
|
echo "Debug: Repository: ${GITEA_OWNER}/${GITEA_REPO}"
|
||||||
|
|
||||||
# Prepare files for upload
|
# Prepare files for upload
|
||||||
FILES=""
|
FILES=""
|
||||||
@ -118,18 +125,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check if tag exists
|
# Test API connection with explicit token header
|
||||||
if ! git rev-parse "v${VERSION}" >/dev/null 2>&1; then
|
|
||||||
echo "Debug: Creating new tag v${VERSION}"
|
|
||||||
git tag -a "v${VERSION}" -m "Release ${VERSION}"
|
|
||||||
git push origin "v${VERSION}"
|
|
||||||
else
|
|
||||||
echo "Debug: Tag v${VERSION} already exists"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Test API connection
|
|
||||||
echo "Debug: Testing API connection..."
|
echo "Debug: Testing API connection..."
|
||||||
TEST_RESPONSE=$(curl -s -w "\n%{http_code}" -H "Authorization: token ${GITEA_TOKEN}" "${GITEA_API_URL}/api/v1/version")
|
TEST_RESPONSE=$(curl -s -w "\n%{http_code}" \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"${GITEA_API_URL}/api/v1/version")
|
||||||
TEST_STATUS=$(echo "$TEST_RESPONSE" | tail -n1)
|
TEST_STATUS=$(echo "$TEST_RESPONSE" | tail -n1)
|
||||||
if [ "$TEST_STATUS" != "200" ]; then
|
if [ "$TEST_STATUS" != "200" ]; then
|
||||||
echo "Error: Cannot connect to Gitea API"
|
echo "Error: Cannot connect to Gitea API"
|
||||||
@ -137,7 +137,7 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create Gitea release using API
|
# Create release using API
|
||||||
echo "Debug: Creating release..."
|
echo "Debug: Creating release..."
|
||||||
RELEASE_DATA="{
|
RELEASE_DATA="{
|
||||||
\"tag_name\": \"v${VERSION}\",
|
\"tag_name\": \"v${VERSION}\",
|
||||||
@ -145,8 +145,9 @@ jobs:
|
|||||||
\"body\": \"${{ steps.changelog.outputs.CHANGES }}\"
|
\"body\": \"${{ steps.changelog.outputs.CHANGES }}\"
|
||||||
}"
|
}"
|
||||||
|
|
||||||
# Create release and capture HTTP status
|
# Create release with explicit token header
|
||||||
RESPONSE=$(curl -v -s -w "\n%{http_code}" -X POST \
|
RESPONSE=$(curl -s -w "\n%{http_code}" \
|
||||||
|
-X POST \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "$RELEASE_DATA" \
|
-d "$RELEASE_DATA" \
|
||||||
@ -156,9 +157,7 @@ jobs:
|
|||||||
RESPONSE_BODY=$(echo "$RESPONSE" | head -n -1)
|
RESPONSE_BODY=$(echo "$RESPONSE" | head -n -1)
|
||||||
|
|
||||||
echo "Debug: HTTP Status: $HTTP_STATUS"
|
echo "Debug: HTTP Status: $HTTP_STATUS"
|
||||||
echo "Debug: Response Body: $RESPONSE_BODY"
|
|
||||||
|
|
||||||
if [ "$HTTP_STATUS" != "201" ]; then
|
if [ "$HTTP_STATUS" != "201" ]; then
|
||||||
echo "Fehler beim Erstellen des Releases: $RESPONSE_BODY"
|
echo "Error: Failed to create release"
|
||||||
|
echo "Response: $RESPONSE_BODY"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
|
Loading…
x
Reference in New Issue
Block a user