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