-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupload.sh
More file actions
executable file
·30 lines (25 loc) · 786 Bytes
/
upload.sh
File metadata and controls
executable file
·30 lines (25 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
if [[ "$CIRRUS_RELEASE" == "" ]]; then
echo "Not a release. No need to deploy!"
exit 0
fi
if [[ "$GITHUB_TOKEN" == "" ]]; then
echo "Please provide GitHub access token via GITHUB_TOKEN environment variable!"
exit 1
fi
file_content_type="application/octet-stream"
if [[ "$files_to_upload" == "" ]]; then
echo "Variable files_to_upload is empty. Exiting!"
exit 1
fi
for fpath in "${files_to_upload[@]}"
do
echo "Uploading $fpath..."
name=$(basename "$fpath")
url_to_upload="https://uploads.github.com/repos/$CIRRUS_REPO_FULL_NAME/releases/$CIRRUS_RELEASE/assets?name=$name"
curl -X POST \
--data-binary @$fpath \
--header "Authorization: token $GITHUB_TOKEN" \
--header "Content-Type: $file_content_type" \
$url_to_upload
done