diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 23f2828..764b2df 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -73,22 +73,22 @@ jobs: BODY="## What's changed"$'\n'"${NOTES}" BODY_JSON=$(printf '%s' "$BODY" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))') + echo "Creating release ${TAG} via ${API}..." RELEASE=$(curl -s -X POST "$API" \ -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/json" \ -d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"body\":${BODY_JSON},\"draft\":true}") + echo "API response: $RELEASE" - UPLOAD_URL=$(echo "$RELEASE" | python3 -c "import json,sys,re; r=json.load(sys.stdin); print(re.sub(r'\{[^}]*\}','',r['upload_url']))") + UPLOAD_URL=$(echo "$RELEASE" | grep -o '"upload_url":"[^"]*"' | cut -d'"' -f4 | sed 's/{[^}]*}//') if [ -z "$UPLOAD_URL" ]; then - echo "Failed to create release: $RELEASE" + echo "upload_url not found in response — aborting" exit 1 fi - echo "$UPLOAD_URL" > /tmp/upload_url.txt - for f in pgtidy-*; do echo "Uploading $f..." - curl -s -X POST "${UPLOAD_URL}?name=${f}" \ + curl -sf -X POST "${UPLOAD_URL}?name=${f}" \ -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: application/octet-stream" \ --data-binary "@${f}" > /dev/null @@ -96,12 +96,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/upload-artifact@v4 - with: - name: upload-url - path: /tmp/upload_url.txt - retention-days: 1 - pkg-deb: name: Debian packages needs: release @@ -140,7 +134,8 @@ jobs: TAG="${{ github.event.inputs.tag || github.ref_name }}" RELEASE=$(curl -s "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG}" \ -H "Authorization: token ${GITHUB_TOKEN}") - UPLOAD_URL=$(echo "$RELEASE" | python3 -c "import json,sys,re; r=json.load(sys.stdin); print(re.sub(r'\{[^}]*\}','',r['upload_url']))") + UPLOAD_URL=$(echo "$RELEASE" | grep -o '"upload_url":"[^"]*"' | cut -d'"' -f4 | sed 's/{[^}]*}//') + [ -z "$UPLOAD_URL" ] && { echo "upload_url not found: $RELEASE"; exit 1; } for f in *.deb; do echo "Uploading $(basename "$f")..." curl -s -X POST "${UPLOAD_URL}?name=$(basename "$f")" \ @@ -205,7 +200,8 @@ jobs: TAG="${{ github.event.inputs.tag || github.ref_name }}" RELEASE=$(curl -s "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG}" \ -H "Authorization: token ${GITHUB_TOKEN}") - UPLOAD_URL=$(echo "$RELEASE" | python3 -c "import json,sys,re; r=json.load(sys.stdin); print(re.sub(r'\{[^}]*\}','',r['upload_url']))") + UPLOAD_URL=$(echo "$RELEASE" | grep -o '"upload_url":"[^"]*"' | cut -d'"' -f4 | sed 's/{[^}]*}//') + [ -z "$UPLOAD_URL" ] && { echo "upload_url not found: $RELEASE"; exit 1; } while IFS= read -r f; do echo "Uploading $(basename "$f")..." curl -s -X POST "${UPLOAD_URL}?name=$(basename "$f")" \ @@ -331,7 +327,8 @@ jobs: TAG="${{ github.event.inputs.tag || github.ref_name }}" RELEASE=$(curl -s "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG}" \ -H "Authorization: token ${GITHUB_TOKEN}") - UPLOAD_URL=$(echo "$RELEASE" | python3 -c "import json,sys,re; r=json.load(sys.stdin); print(re.sub(r'\{[^}]*\}','',r['upload_url']))") + UPLOAD_URL=$(echo "$RELEASE" | grep -o '"upload_url":"[^"]*"' | cut -d'"' -f4 | sed 's/{[^}]*}//') + [ -z "$UPLOAD_URL" ] && { echo "upload_url not found: $RELEASE"; exit 1; } for f in editors/vscode/*.vsix; do echo "Uploading $(basename "$f")..." curl -s -X POST "${UPLOAD_URL}?name=$(basename "$f")" \ @@ -364,7 +361,8 @@ jobs: TAG="${{ github.event.inputs.tag || github.ref_name }}" RELEASE=$(curl -s "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG}" \ -H "Authorization: token ${GITHUB_TOKEN}") - UPLOAD_URL=$(echo "$RELEASE" | python3 -c "import json,sys,re; r=json.load(sys.stdin); print(re.sub(r'\{[^}]*\}','',r['upload_url']))") + UPLOAD_URL=$(echo "$RELEASE" | grep -o '"upload_url":"[^"]*"' | cut -d'"' -f4 | sed 's/{[^}]*}//') + [ -z "$UPLOAD_URL" ] && { echo "upload_url not found: $RELEASE"; exit 1; } for f in editors/datagrip/build/distributions/*.zip; do echo "Uploading $(basename "$f")..." curl -s -X POST "${UPLOAD_URL}?name=$(basename "$f")" \