fix(ci): use single-line JSON for curl and add missing GITEA_REF_NAME
This commit is contained in:
@@ -114,15 +114,7 @@ jobs:
|
|||||||
GITEA_REF_NAME: ${{ gitea.ref_name }}
|
GITEA_REF_NAME: ${{ gitea.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
# JSON-escape the release body with sed: backslashes first, then
|
BODY=$(sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/\t/\\t/g' -e 's/\r//g' release-body.md | sed ':a;N;$!ba;s/\n/\\n/g')
|
||||||
# quotes, tabs, and carriage returns, and finally fold newlines into
|
|
||||||
# \n. Wrap the result in quotes to form a JSON string.
|
|
||||||
BODY=$(sed -e 's/\\/\\\\/g' \
|
|
||||||
-e 's/"/\\"/g' \
|
|
||||||
-e 's/\t/\\t/g' \
|
|
||||||
-e 's/\r//g' \
|
|
||||||
release-body.md \
|
|
||||||
| sed ':a;N;$!ba;s/\n/\\n/g')
|
|
||||||
BODY="\"${BODY}\""
|
BODY="\"${BODY}\""
|
||||||
|
|
||||||
response=$(curl -sS -w '\n%{http_code}' \
|
response=$(curl -sS -w '\n%{http_code}' \
|
||||||
@@ -130,13 +122,7 @@ jobs:
|
|||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-X POST \
|
-X POST \
|
||||||
"${GITEA_SERVER_URL}/api/v1/repos/${GITEA_REPOSITORY}/releases" \
|
"${GITEA_SERVER_URL}/api/v1/repos/${GITEA_REPOSITORY}/releases" \
|
||||||
-d "{
|
-d "{\"tag_name\":\"${GITEA_REF_NAME}\",\"name\":\"${GITEA_REF_NAME}\",\"body\":${BODY},\"draft\":false,\"prerelease\":false}")
|
||||||
\"tag_name\": \"${GITEA_REF_NAME}\",
|
|
||||||
\"name\": \"${GITEA_REF_NAME}\",
|
|
||||||
\"body\": ${BODY},
|
|
||||||
\"draft": false,
|
|
||||||
\"prerelease": false
|
|
||||||
}")
|
|
||||||
|
|
||||||
http_code=$(echo "$response" | tail -1)
|
http_code=$(echo "$response" | tail -1)
|
||||||
body=$(echo "$response" | sed '$d')
|
body=$(echo "$response" | sed '$d')
|
||||||
@@ -157,6 +143,7 @@ jobs:
|
|||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||||
GITEA_REPOSITORY: ${{ gitea.repository }}
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
||||||
|
GITEA_REF_NAME: ${{ gitea.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
RELEASE_ID=$(cat release-id.txt)
|
RELEASE_ID=$(cat release-id.txt)
|
||||||
|
|||||||
Reference in New Issue
Block a user