fix: gitea variables don't work in scripts
This commit is contained in:
parent
bca0ff6db5
commit
ed4c541cb4
@ -1,10 +1,9 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
#shellcheck disable=SC2016
|
|
||||||
|
|
||||||
API='${{ gitea.server_url }}/api/actions_pipeline/_apis/pipelines/workflows/${{ gitea.run_id }}/artifacts?api-version=6.0-preview'
|
API="$GITHUB_SERVER_URL/api/actions_pipeline/_apis/pipelines/workflows/$GITHUB_RUN_ID/artifacts?api-version=6.0-preview"
|
||||||
CURL=(curl --fail -v -D/dev/stdout
|
CURL=(curl --fail -v -D/dev/stdout
|
||||||
--header "Authorization: Bearer \${{ inputs.token }}"
|
--header "Authorization: Bearer $INPUT_TOKEN"
|
||||||
--data '{"Type":"actions_storage","Name":"${{ inputs.name }}"}'
|
--data '{"Type":"actions_storage","Name":"'"$INPUT_NAME"'"}'
|
||||||
)
|
)
|
||||||
|
|
||||||
"${CURL[@]}" -XPOST "$API" -oresp0.json
|
"${CURL[@]}" -XPOST "$API" -oresp0.json
|
||||||
@ -13,16 +12,16 @@ UPLOAD_URL=$(jq -r '.fileContainerResourceUrl' resp0.json)
|
|||||||
rm -f resp0.json
|
rm -f resp0.json
|
||||||
|
|
||||||
#shellcheck disable=SC1083
|
#shellcheck disable=SC1083
|
||||||
for artifact in \${{ inputs.path }}; do
|
for artifact in $INPUT_PATH; do
|
||||||
content_length=$(stat -c '%s' "$artifact")
|
content_length=$(stat -c '%s' "$artifact")
|
||||||
md5=$(cksum -amd5 --base64 --untagged "$artifact" | awk '{print $1}')
|
md5=$(cksum -amd5 --base64 --untagged "$artifact" | awk '{print $1}')
|
||||||
"${CURL[@]}" -XPUT -o resp1.json \
|
"${CURL[@]}" -XPUT -o resp1.json \
|
||||||
--header "x-actions-results-md5: $md5" \
|
--header "x-actions-results-md5: $md5" \
|
||||||
--header "x-tfs-filelength: $content_length" \
|
--header "x-tfs-filelength: $content_length" \
|
||||||
--header "content-range: bytes 0-$((content_length - 1))/$content_length" \
|
--header "content-range: bytes 0-$((content_length - 1))/$content_length" \
|
||||||
"$UPLOAD_URL?retentionDays=\${{ inputs.retention-days }}&itemPath=\${{ inputs.name }}%2F$artifact"
|
"$UPLOAD_URL?retentionDays=$INPUT_RETENTION_DAYS&itemPath=$INPUT_NAME%2F$artifact"
|
||||||
cat resp1.json
|
cat resp1.json
|
||||||
"${CURL[@]}" -XPATCH -oresp2.json "$API&artifactName=\${{ inputs.name }}"
|
"${CURL[@]}" -XPATCH -oresp2.json "$API&artifactName=$INPUT_NAME"
|
||||||
cat resp2.json
|
cat resp2.json
|
||||||
rm -f resp1.json resp2.json
|
rm -f resp1.json resp2.json
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user