artifact not required
This commit is contained in:
parent
f938b45fe8
commit
de2dfcf4e6
@ -12,10 +12,10 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
artifactName:
|
artifactName:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
fileName:
|
fileName:
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
jobs:
|
jobs:
|
||||||
UpdateRelease:
|
UpdateRelease:
|
||||||
@ -68,30 +68,31 @@ jobs:
|
|||||||
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/releases/$release_id")
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/releases/$release_id")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${{ inputs.artifactName }}" != "null" ]; then
|
||||||
|
artifact_file="./${{ inputs.fileName }}"
|
||||||
|
artifact_name=$(basename "$artifact_file")
|
||||||
|
|
||||||
artifact_file="./${{ inputs.fileName }}"
|
echo "Checking artifact '$artifact_file'"
|
||||||
artifact_name=$(basename "$artifact_file")
|
if [ -f "$artifact_file" ]; then
|
||||||
|
echo "Uploading artifact '$artifact_name' to release $release_id..."
|
||||||
|
|
||||||
echo "Checking artifact '$artifact_file'"
|
upload_response=$(curl -s -o response.json -w "%{http_code}" -X POST \
|
||||||
if [ -f "$artifact_file" ]; then
|
-H "Authorization: token $API_TOKEN" \
|
||||||
echo "Uploading artifact '$artifact_name' to release $release_id..."
|
-H "Content-Type: multipart/form-data" \
|
||||||
|
-F "name=$artifact_name" \
|
||||||
|
-F "attachment=@$artifact_file" \
|
||||||
|
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/releases/$release_id/assets")
|
||||||
|
|
||||||
upload_response=$(curl -s -o response.json -w "%{http_code}" -X POST \
|
http_code=$(echo "$upload_response" | tail -n1) # Last line is the HTTP code
|
||||||
-H "Authorization: token $API_TOKEN" \
|
if [ "$http_code" -ne 201 ]; then
|
||||||
-H "Content-Type: multipart/form-data" \
|
echo "Artifact upload failed with HTTP code: $http_code"
|
||||||
-F "name=$artifact_name" \
|
echo "Response: $(cat response.json)"
|
||||||
-F "attachment=@$artifact_file" \
|
exit 1
|
||||||
"$GITEA_API_URL/repos/$OWNER/${{ inputs.repo }}/releases/$release_id/assets")
|
else
|
||||||
|
echo "Artifact uploaded successfully."
|
||||||
http_code=$(echo "$upload_response" | tail -n1) # Last line is the HTTP code
|
fi
|
||||||
if [ "$http_code" -ne 201 ]; then
|
|
||||||
echo "Artifact upload failed with HTTP code: $http_code"
|
|
||||||
echo "Response: $(cat response.json)"
|
|
||||||
exit 1
|
|
||||||
else
|
else
|
||||||
echo "Artifact uploaded successfully."
|
echo "Artifact file '$artifact_file' not found. Exiting."
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "Artifact file '$artifact_file' not found. Exiting."
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue
Block a user