File tree Expand file tree Collapse file tree 1 file changed +20
-17
lines changed
Expand file tree Collapse file tree 1 file changed +20
-17
lines changed Original file line number Diff line number Diff line change 1212# User supplied args
1313GITHUB_TOKEN=$1
1414if [[ -z $GITHUB_TOKEN ]]; then echo " Missing arg1 GITHUB_TOKEN" && exit 1; fi
15- ARTIFACTS_DIR=$2
16- if [[ -z $ARTIFACTS_DIR ]]; then echo " Missing arg2 ARTIFACTS_DIR" && exit 1; fi
1715
1816# Set automatically by CircleCI
1917: ${CIRCLE_PROJECT_REPONAME?" Missing required env var" }
4341 exit 1
4442fi
4543
46- for f in $ARTIFACTS_DIR ; do
47- # treat directories and files differently
48- if [ -d $f ]; then
49- for ff in $( ls $f ) ; do
50- echo -e " uploading $ff "
51- github-release upload -u $USER -r $REPO -t $TAG -n $ff -f $f /$ff -s $GITHUB_TOKEN
52- done
53- elif [ -f $f ]; then
54- echo -e " uploading $f "
55- github-release upload -u $USER -r $REPO -t $TAG -n $f -f $f -s $GITHUB_TOKEN
56- else
57- echo -e " $f is not a file or directory"
58- exit 1
59- fi
60- done
44+ ARTIFACTS_DIR=$2
45+ if [[ -z $ARTIFACTS_DIR ]]; then
46+ echo " Skipping publishing artifacts. No ARTIFACTS_DIR env var set" ;
47+ else
48+ for f in $ARTIFACTS_DIR ; do
49+ # treat directories and files differently
50+ if [ -d $f ]; then
51+ for ff in $( ls $f ) ; do
52+ echo -e " uploading $ff "
53+ github-release upload -u $USER -r $REPO -t $TAG -n $ff -f $f /$ff -s $GITHUB_TOKEN
54+ done
55+ elif [ -f $f ]; then
56+ echo -e " uploading $f "
57+ github-release upload -u $USER -r $REPO -t $TAG -n $f -f $f -s $GITHUB_TOKEN
58+ else
59+ echo -e " $f is not a file or directory"
60+ exit 1
61+ fi
62+ done
63+ fi
You can’t perform that action at this time.
0 commit comments