Skip to content

Commit 7beb9dc

Browse files
Merge pull request #32 from Clever/DOC-2048-systemic-release
Make ARTIFACTS_DIR optional
2 parents 449d4ff + 205fc66 commit 7beb9dc

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

circleci/github-release

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ set -e
1212
# User supplied args
1313
GITHUB_TOKEN=$1
1414
if [[ -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"}
@@ -43,18 +41,23 @@ else
4341
exit 1
4442
fi
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

0 commit comments

Comments
 (0)