-
Notifications
You must be signed in to change notification settings - Fork 1
/
step.sh
26 lines (21 loc) · 1.05 KB
/
step.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
#!/bin/bash
# fail if any commands fails
set -e
# debug log
set -x
#Install jq
echo $OSTYPE
if [[ "$OSTYPE" == "linux-gnu" ]]; then
sudo apt-get -y install jq
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install jq
fi
#GetAPP
buildslug=$(curl -H "accept: application/json" -H "Authorization: ${access_token}" -X GET https://api.bitrise.io/v0.1/apps/${app_slug}/builds?workflow=${workflow}'&'status=1'&'limit=1 | jq -r '.data[].slug ')
echo $buildslug
artifactslug=$(curl -H "accept: application/json" -H "Authorization: ${access_token}" -X GET https://api.bitrise.io/v0.1/apps/${app_slug}/builds/$buildslug/artifacts | jq --arg e "${artifact_name}" -r '.data[] | select(.title==$e) | .slug')
echo $artifactslug
lasturl=$(curl -H "accept: application/json" -H "Authorization: ${access_token}" -X GET https://api.bitrise.io/v0.1/apps/${app_slug}/builds/$buildslug/artifacts/$artifactslug | jq -r '.[] | .expiring_download_url')
(mkdir -p $BITRISE_SOURCE_DIR/${directory_name} && cd $BITRISE_SOURCE_DIR/${directory_name}
curl $lasturl > "${artifact_name}"
)