mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2025-12-08 14:22:40 +01:00
@@ -17,12 +17,25 @@ API_VERSION=v3
|
||||
API_HEADER="Accept: application/vnd.github.${API_VERSION}+json"
|
||||
AUTH_HEADER="Authorization: token ${GITHUB_TOKEN}"
|
||||
|
||||
# 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; }
|
||||
main(){
|
||||
local files
|
||||
|
||||
tag_response=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${GITHUB_REPOSITORY}/releases/latest")
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "Must pass files to be uploaded..."
|
||||
exit 1
|
||||
fi
|
||||
files=( "$@" )
|
||||
|
||||
tag_name=$(echo $tag_response | jq -e --raw-output .tag_name)
|
||||
tag_id=$(echo $tag_response | jq -e --raw-output .id)
|
||||
# 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; }
|
||||
|
||||
echo "tag name: ${tag_name} tag id: ${tag_id}"
|
||||
tag_response=$(curl -sSL -H "${AUTH_HEADER}" -H "${API_HEADER}" "${URI}/repos/${GITHUB_REPOSITORY}/releases/latest")
|
||||
|
||||
tag_name=$(echo $tag_response | jq -e --raw-output .tag_name)
|
||||
tag_id=$(echo $tag_response | jq -e --raw-output .id)
|
||||
|
||||
echo "Uploading files: ${files[@]}"
|
||||
echo "For tag name: ${tag_name} tag id: ${tag_id}"
|
||||
}
|
||||
|
||||
main $@
|
||||
|
||||
Reference in New Issue
Block a user