This commit is contained in:
parent
85b1673d0d
commit
e4115f101c
1 changed files with 7 additions and 8 deletions
|
|
@ -50,7 +50,8 @@ jobs:
|
||||||
echo "Token length: ${#FORGEJO_TOKEN}"
|
echo "Token length: ${#FORGEJO_TOKEN}"
|
||||||
|
|
||||||
TAG="${{ github.event.inputs.tag || github.ref_name }}"
|
TAG="${{ github.event.inputs.tag || github.ref_name }}"
|
||||||
API_BASE="${{ github.server_url }}/api/v1"
|
# use internal docker network URL instead of external
|
||||||
|
API_BASE="http://forgejo:3000/api/v1"
|
||||||
REPO="${{ github.repository }}"
|
REPO="${{ github.repository }}"
|
||||||
|
|
||||||
# ensure tag exists (create at HEAD if not)
|
# ensure tag exists (create at HEAD if not)
|
||||||
|
|
@ -69,15 +70,13 @@ jobs:
|
||||||
|
|
||||||
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
|
if [ "$RELEASE_ID" = "null" ] || [ -z "$RELEASE_ID" ]; then
|
||||||
echo "Creating release for ${TAG}..."
|
echo "Creating release for ${TAG}..."
|
||||||
echo '{"tag_name": "'"${TAG}"'", "name": "'"${TAG}"'"}' > /tmp/payload.json
|
RESPONSE=$(curl -s -X POST \
|
||||||
cat /tmp/payload.json
|
|
||||||
RESPONSE=$(curl -sv --http1.1 -X POST \
|
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
-H "Authorization: token ${FORGEJO_TOKEN}" \
|
||||||
--data-binary @/tmp/payload.json \
|
-d '{"tag_name": "'"${TAG}"'", "name": "'"${TAG}"'"}' \
|
||||||
"${API_BASE}/repos/${REPO}/releases" 2>&1)
|
"${API_BASE}/repos/${REPO}/releases")
|
||||||
echo "Full response: ${RESPONSE}"
|
echo "Create response: ${RESPONSE}"
|
||||||
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
|
RELEASE_ID=$(echo "$RESPONSE" | jq -r '.id')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Release ID: ${RELEASE_ID}"
|
echo "Release ID: ${RELEASE_ID}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue