Skip to content

Commit

Permalink
bintray: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
makefu committed May 10, 2016
1 parent 9fcf9e0 commit 00386b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ script:
- test ! -e "$PREBUILD" || ( cp "$PREBUILD" builder/ && (cd builder/ && sh $(basename $PREBUILD)) && echo "prebuild script successful" )
- ./builder/init
- ls -lh ./builder/bin/*/*squashfs*
find ./builder/bin -type f -regex ".*squashfs.*\.\(bin\|img\)" -regextype posix-egrep -exec bash -e bintray.sh {} \;
- find ./builder/bin -type f -regex ".*squashfs.*\.\(bin\|img\)" -regextype posix-egrep -print0 | xargs -0 -n1 bash -e bintray.sh
28 changes: 11 additions & 17 deletions bintray.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Push firmware images and related metadata to Bintray
# https://bintray.com/docs/api/

trap 'exit 1' ERR
set -e

API=https://api.bintray.com

Expand Down Expand Up @@ -32,14 +32,14 @@ which curl || exit 1
which grep || exit 1

if [ ! $(env | grep BINTRAY_API_KEY ) ] ; then
echo "Environment variable \$BINTRAY_API_KEY missing"
echo "!! Environment variable \$BINTRAY_API_KEY missing"
exit 1
fi

# Do not upload artefacts generated as part of a pull request
if [ $(env | grep TRAVIS_PULL_REQUEST ) ] ; then
if [ "$TRAVIS_PULL_REQUEST" != "false" ] ; then
echo "Not uploading since this is a pull request"
echo "* Not uploading since this is a pull request"
exit 0
fi
fi
Expand All @@ -53,18 +53,9 @@ MINIKREBS_VERSION=$(git log -1 --format=format:%h)
VERSION=${MINIKREBS_VERSION}-openwrt@${OWRT_VERSION}
# VERSION=$(git rev-list --count HEAD).$(git log -n 1 | head -n 1 | sed -e 's/^commit //' | head -c 8)

if [ "$VERSION" == "" ] ; then
echo "* VERSION missing, exiting"
exit 1
else
echo "* VERSION $VERSION"
fi

# exit 0
##########
echo "* VERSION $VERSION"

echo ""
echo "Creating package ${PCK_NAME}..."
echo "* Creating package ${PCK_NAME}..."
data="{
\"name\": \"${PCK_NAME}\",
\"desc\": ${DESCRIPTION},
Expand All @@ -78,17 +69,20 @@ echo "Creating package ${PCK_NAME}..."
${CURL} -X POST -d "${data}" "${API}/packages/${BINTRAY_SUBJECT}/${BINTRAY_REPO}"

echo ""
echo "Uploading and publishing ${FILE}..."
echo "* Uploading and publishing ${FILE}..."
ret="$(${CURL} -T ${FILE} "${API}/content/${BINTRAY_SUBJECT}/${BINTRAY_REPO}/${PCK_NAME}/${VERSION}/$PCK_NAME-$MINIKREBS_VERSION-$(basename ${FILE})?publish=1")"
if echo "$ret" | egrep -qi "(failed|unable)";then
echo "Something went wrong while publishing file to bintray:"
echo "!! Something went wrong while publishing file to bintray:"
echo "$ret"
exit 1
else
echo "* Upload successful:"
echo "$ret"
fi

if [ $(env | grep TRAVIS_JOB_ID ) ] ; then
echo ""
echo "Adding Travis CI log to release notes..."
echo "* Adding Travis CI log to release notes..."
BUILD_LOG="https://api.travis-ci.org/jobs/${TRAVIS_JOB_ID}/log.txt?deansi=true"
data='{
"bintray": {
Expand Down

0 comments on commit 00386b6

Please sign in to comment.