-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_artifacts.sh
30 lines (26 loc) · 880 Bytes
/
upload_artifacts.sh
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"
files_to_upload=(
"build/app/outputs/apk/release/app-armeabi-v7a-release.apk"
"build/app/outputs/apk/release/app-arm64-v8a-release.apk"
"build/app/outputs/bundle/release/app-release.aab"
)
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