mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 11:31:49 +01:00
update
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
df6348bce9
commit
558f2cc472
|
@ -34,20 +34,27 @@ main(){
|
|||
# Validate the GitHub token.
|
||||
curl -o /dev/null -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${GITHUB_REPOSITORY}" || { echo "Error: Invalid repo, token or network issue!"; exit 1; }
|
||||
|
||||
tag_response=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${GITHUB_REPOSITORY}/releases/latest")
|
||||
# Get the tags.
|
||||
tag_response=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${GITHUB_REPOSITORY}/tags")
|
||||
|
||||
tag_name=$(echo $tag_response | jq -e --raw-output .tag_name)
|
||||
tag_id=$(echo $tag_response | jq -e --raw-output .id)
|
||||
tag_name=$(echo $tag_response | jq -e --raw-output .[0].name)
|
||||
tag_id=$(echo $tag_response | jq -e --raw-output .[0].id)
|
||||
|
||||
# Create the release.
|
||||
echo "Creating release for tag name: ${tag_name}"
|
||||
response=$(curl -XPOST -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${GITHUB_REPOSITORY}/release" --data '{"tag_name": "'${tag_name}'","name":"'${tag_name}'","draft":false,"prerelease":false}')
|
||||
release_id=$(echo $response | jq -e --raw-output .id)
|
||||
|
||||
# Upload the files.
|
||||
echo "Uploading files: ${files[@]}"
|
||||
echo "For tag name: ${tag_name} tag id: ${tag_id}"
|
||||
|
||||
for file in ${files[@]}; do
|
||||
filename=$(basename "$file")
|
||||
curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" \
|
||||
curl -XPOST -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" \
|
||||
--data-binary @"$file" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${tag_id}/assets?name=${filename}"
|
||||
"https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${release_id}/assets?name=${filename}"
|
||||
|
||||
echo "Successfully uploaded: ${file}!"
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue
Block a user