cleanup
This commit is contained in:
parent
e5033a2db8
commit
6c06ed0d6f
@ -1,24 +1,18 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
curl --fail -v -D /dev/stdout -o resp0.json --header "Authorization: Bearer $ACTIONS_RUNTIME_TOKEN" \
|
API="$GITHUB_SERVER_URL/api/actions_pipeline/_apis/pipelines/workflows/$GITHUB_RUN_ID/artifacts?api-version=6.0-preview"
|
||||||
-X POST --data "{\"Type\":\"actions_storage\",\"Name\":\"$INPUT_NAME\"}" \
|
CURL=(curl -H "Authorization: Bearer $ACTIONS_RUNTIME_TOKEN")
|
||||||
"$GITHUB_SERVER_URL/api/actions_pipeline/_apis/pipelines/workflows/$GITHUB_RUN_ID/artifacts?api-version=6.0-preview"
|
|
||||||
cat resp0.json
|
UPLOAD_URL="$("${CURL[@]}" --data "{\"Type\":\"actions_storage\",\"Name\":\"$INPUT_NAME\"}" "$API" | jq -r '.fileContainerResourceUrl')"
|
||||||
UPLOAD_URL=$(jq -r '.fileContainerResourceUrl' resp0.json)
|
|
||||||
for artifact in $INPUT_PATH; do
|
for artifact in $INPUT_PATH; do
|
||||||
content_length=$(ls -l "$artifact" | awk '{print $5}')
|
content_length=$(stat -c '%s' "$artifact")
|
||||||
md5=$(openssl md5 -binary "$artifact" | base64)
|
md5=$(openssl md5 -binary "$artifact" | base64)
|
||||||
curl --fail -v -D /dev/stdout -o resp1.json --header "Authorization: Bearer $ACTIONS_RUNTIME_TOKEN" \
|
"${CURL[@]}" -XPUT \
|
||||||
--header "x-actions-results-md5: $md5" \
|
-H "x-actions-results-md5: $md5" \
|
||||||
--header "x-tfs-filelength: ${content_length}" \
|
-H "x-tfs-filelength: ${content_length}" \
|
||||||
--header "content-range: bytes 0-$((content_length-1))/${content_length}" \
|
-H "content-range: bytes 0-$((content_length-1))/${content_length}" \
|
||||||
-X PUT --data-binary "@$artifact" \
|
--data-binary "@$artifact" \
|
||||||
"${UPLOAD_URL}?retentionDays=$INPUT_RETENTION_DAYS&itemPath=$INPUT_NAME%2F$artifact"
|
"$UPLOAD_URL?retentionDays=$INPUT_RETENTION_DAYS&itemPath=$INPUT_NAME%2F$artifact"
|
||||||
cat resp1.json
|
"${CURL[@]}" -XPATCH \
|
||||||
curl --fail -v -D /dev/stdout -o resp2.json --header "Authorization: Bearer $ACTIONS_RUNTIME_TOKEN" \
|
"$API&artifactName=$INPUT_NAME"
|
||||||
-X PATCH \
|
|
||||||
"$GITHUB_SERVER_URL/api/actions_pipeline/_apis/pipelines/workflows/$GITHUB_RUN_ID/artifacts?api-version=6.0-preview&artifactName=$INPUT_NAME"
|
|
||||||
cat resp2.json
|
|
||||||
rm resp1.json resp2.json
|
|
||||||
done
|
done
|
||||||
rm resp0.json
|
|
||||||
|
Loading…
Reference in New Issue
Block a user