Improve release creation logging

This commit is contained in:
2026-04-16 19:18:52 +02:00
parent 0e1f2e0bd7
commit cf4aa32061

View File

@@ -34,32 +34,46 @@ jobs:
- name: Create Release - name: Create Release
run: | run: |
set -x TAG_NAME="${GITHUB_REF#refs/tags/}"
TAG_NAME=${GITHUB_REF#refs/tags/}
APK_FILE=$(ls app/build/outputs/apk/release/*.apk | head -1) APK_FILE=$(ls app/build/outputs/apk/release/*.apk | head -1)
echo "Tag: $TAG_NAME" echo "=== Creating release for tag: $TAG_NAME ==="
echo "APK: $APK_FILE" echo "APK file: $APK_FILE"
echo "Token exists: ${{ secrets.GITHUB_TOKEN != '' }}"
TOKEN=${{ secrets.GITHUB_TOKEN }} # Use the token from secrets
if [ -z "${{ secrets.GITHUB_TOKEN }}" ]; then
echo "ERROR: No GITHUB_TOKEN found"
exit 1
fi
# Create release # Create release using Gitea API
RELEASE_JSON=$(curl -s -X POST "https://git-dangilcal.duckdns.org/api/v1/repos/dangilcal/Helldivers-app-movil/releases" \ echo "Creating release..."
RELEASE_RESP=$(curl -s -X POST "https://git-dangilcal.duckdns.org/api/v1/repos/dangilcal/Helldivers-app-movil/releases" \
-H "accept: application/json" \ -H "accept: application/json" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Authorization: token $TOKEN" \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"Release $TAG_NAME\", \"draft\": false, \"prerelease\": false}") -d "{\"tag_name\": \"${TAG_NAME}\", \"name\": \"Release ${TAG_NAME}\", \"draft\": false, \"prerelease\": false}")
echo "Release created: $RELEASE_JSON" echo "Release response: $RELEASE_RESP"
RELEASE_ID=$(echo $RELEASE_JSON | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) # Extract release ID
RELEASE_ID=$(echo "$RELEASE_RESP" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
if [ -z "$RELEASE_ID" ]; then
echo "ERROR: Could not get release ID"
echo "$RELEASE_RESP"
exit 1
fi
echo "Release ID: $RELEASE_ID" echo "Release ID: $RELEASE_ID"
# Upload asset # Upload the APK as an asset
curl -v -X POST "https://git-dangilcal.duckdns.org/api/v1/repos/dangilcal/Helldivers-app-movil/releases/$RELEASE_ID/assets" \ echo "Uploading APK..."
UPLOAD_RESP=$(curl -s -X POST "https://git-dangilcal.duckdns.org/api/v1/repos/dangilcal/Helldivers-app-movil/releases/${RELEASE_ID}/assets" \
-H "accept: application/json" \ -H "accept: application/json" \
-H "Content-Type: multipart/form-data" \ -H "Content-Type: multipart/form-data" \
-H "Authorization: token $TOKEN" \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-F "attachment=@$APK_FILE" -F "attachment=@${APK_FILE}")
echo "Upload response: $UPLOAD_RESP"
echo "=== Release created successfully ==="