fix: use printf for JSON body and Authorization header for Gitea API
Release / build-and-release (push) Failing after 56s
Release / build-and-release (push) Failing after 56s
This commit is contained in:
@@ -63,19 +63,20 @@ jobs:
|
|||||||
- name: Create Release and upload assets
|
- name: Create Release and upload assets
|
||||||
run: |
|
run: |
|
||||||
TOKEN="${{ secrets.TOKEN_BUILD }}"
|
TOKEN="${{ secrets.TOKEN_BUILD }}"
|
||||||
API="${{ gitea.server_url }}/api/v1"
|
|
||||||
REPO="${{ gitea.repository }}"
|
REPO="${{ gitea.repository }}"
|
||||||
TAG="${{ gitea.ref_name }}"
|
TAG="${{ gitea.ref_name }}"
|
||||||
|
API="https://git.datadunia.com/api/v1"
|
||||||
|
|
||||||
|
JSON_BODY=$(printf '{"tag_name":"%s","name":"%s","body":"Release %s","draft":false,"prerelease":false}' "$TAG" "$TAG" "$TAG")
|
||||||
|
|
||||||
RELEASE_RESP=$(curl -s -X POST \
|
RELEASE_RESP=$(curl -s -X POST \
|
||||||
|
-H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Release $TAG\",\"draft\":false,\"prerelease\":false}" \
|
-d "$JSON_BODY" \
|
||||||
"$API/repos/$REPO/releases?token=$TOKEN")
|
"$API/repos/$REPO/releases")
|
||||||
echo "Release response: $RELEASE_RESP"
|
echo "Release response: $RELEASE_RESP"
|
||||||
|
|
||||||
RELEASE_ID=$(echo "$RELEASE_RESP" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
|
RELEASE_ID=$(echo "$RELEASE_RESP" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
|
||||||
echo "Release ID: $RELEASE_ID"
|
|
||||||
|
|
||||||
if [ -z "$RELEASE_ID" ]; then
|
if [ -z "$RELEASE_ID" ]; then
|
||||||
echo "Failed to create release"
|
echo "Failed to create release"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -84,9 +85,9 @@ jobs:
|
|||||||
for FILE in wgrplane-linux-amd64 wgrplane-linux-arm64 latest.json; do
|
for FILE in wgrplane-linux-amd64 wgrplane-linux-arm64 latest.json; do
|
||||||
echo "Uploading $FILE..."
|
echo "Uploading $FILE..."
|
||||||
curl -s -X POST \
|
curl -s -X POST \
|
||||||
|
-H "Authorization: token $TOKEN" \
|
||||||
-F "attachment=@$FILE" \
|
-F "attachment=@$FILE" \
|
||||||
"$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$FILE&token=$TOKEN"
|
"$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$FILE"
|
||||||
echo ""
|
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Cleanup build artifacts
|
- name: Cleanup build artifacts
|
||||||
|
|||||||
Reference in New Issue
Block a user