diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index cfff714..2c5173f 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -136,35 +136,32 @@ jobs: # Nur fürs Log: echo "ZIP_NAME=${ZIP_NAME}" - - name: Check if release exists - id: check_release - run: | - RESPONSE=$(curl -s \ - -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ - "https://${{ vars.RELEASE_URL }}/api/v1/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}") - - echo "response=$RESPONSE" >> $GITHUB_OUTPUT - echo "Check response: $RESPONSE" - - name: Create Gitea Release id: create_release run: | - VERSION="${{ steps.info.outputs.version }}" - IS_PRERELEASE=true - [[ "${{ steps.info.outputs.channel }}" == "stable" ]] && IS_PRERELEASE=false - - RESPONSE=$(curl -s -X POST \ + echo "Kommuniziere mit Gitea API über HTTPS..." + API_RESPONSE=$(curl -s -k -X POST "https://${{ vars.RELEASE_URL }}/api/v1/repos/${{ github.repository }}/releases" \ + -H "accept: application/json" \ -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ -H "Content-Type: application/json" \ - "https://${{ vars.RELEASE_URL }}/api/v1/repos/${{ github.repository }}/releases" \ - -d "{ - \"tag_name\": \"${{ github.ref_name }}\", - \"name\": \"Release ${VERSION}\", - \"prerelease\": ${IS_PRERELEASE} - }") - - RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) - echo "release_id=${RELEASE_ID}" >> $GITHUB_OUTPUT + -d '{ + "body": "Dieses Release wurde automatisch vom Gitea Runner erstellt.", + "draft": false, + "name": "Version ${{ github.ref_name }}", + "prerelease": false, + "tag_name": "${{ github.ref_name }}" + }') + + RELEASE_ID=$(echo $API_RESPONSE | jq -r '.id') + + if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then + echo "Fehler beim Erstellen des Releases. API Antwort:" + echo $API_RESPONSE + exit 1 + fi + + echo "Release ID: $RELEASE_ID" + echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV - name: Upload ZIP asset id: upload_asset