Skip to content

Commit 6a58ec2

Browse files
committed
add shell script to download artifacts from ci
1 parent ab592f5 commit 6a58ec2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.circleci/download_artifacts.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#! /bin/bash
2+
#
3+
# https://circleci.com/docs/2.0/artifacts/#downloading-all-artifacts-for-a-build-on-circleci
4+
5+
if [[ $# -eq 0 ]] ; then
6+
echo 'Must provide Circle CI built number'
7+
echo 'Go to https://circleci.com/gh/plotly/plotly.js to find out'
8+
exit 1
9+
fi
10+
11+
if [[ -z "${CIRCLECI_TOKEN}" ]]; then
12+
echo 'CIRCLECI_TOKEN environment variable must be set'
13+
echo 'Go to https://circleci.com/account/api to generate an access token'
14+
exit 1
15+
fi
16+
17+
BUILT=$1
18+
URL="https://circleci.com/api/v1.1/project/github/plotly/plotly.js/$BUILT/artifacts?circle-token=$CIRCLECI_TOKEN"
19+
DIR="$(dirname $0)/../build/circleci-artifacts-$BUILT"
20+
21+
mkdir -p $DIR/{test_images,test_images_diff}
22+
23+
FILES=$(curl -s $URL | grep -o 'https://[^"]*')
24+
25+
for f in $FILES; do
26+
if [[ $f == *"/test_images/"* ]]; then
27+
wget $f %$CIRCLECI_TOKEN -q --show-progress -P $DIR/test_images
28+
elif [[ $f == *"/test_images_diff/"* ]]; then
29+
wget $f %$CIRCLECI_TOKEN -q --show-progress -P $DIR/test_images_diff
30+
fi
31+
done

0 commit comments

Comments
 (0)