-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
85 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash -e | ||
|
||
if [ "$#" -ne 2 ]; then | ||
echo "usage: $0 <API_KEY> <FILE>" | ||
exit 1 | ||
fi | ||
|
||
URL=https://avocado-builds.czekanski.info/api/upload | ||
FILES="" | ||
|
||
if [ -f "$2" ]; then | ||
FILES="-F file=@\"$2\"" | ||
elif [ -d "$2" ]; then | ||
for entry in "$2"/*; do | ||
# skip dirs | ||
[ -f "$entry" ] || continue | ||
|
||
FILES="$FILES -F file=@\"$entry\"" | ||
done | ||
else | ||
echo "$2 does not exist" | ||
exit 2 | ||
fi | ||
|
||
BRANCH="" | ||
if [[ ! -z "${TRAVIS_BRANCH}" ]]; then | ||
BRANCH=$TRAVIS_BRANCH | ||
elif [[ ! -z "${APPVEYOR_REPO_BRANCH}" ]]; then | ||
BRANCH=$APPVEYOR_REPO_BRANCH | ||
else | ||
echo "TRAVIS_BRANCH or APPVEYOR_REPO_BRANCH env not found" | ||
exit 3 | ||
fi | ||
|
||
REVISION="$(git rev-parse --short=7 HEAD)" | ||
AUTHOR="$(git log -1 "$REVISION" --pretty="%cN")" | ||
MESSAGE="$(git log -1 "$REVISION" --pretty="%s")" | ||
DATE="$(git log -1 "$REVISION" --pretty="%cI")" | ||
|
||
curl -X POST \ | ||
-H "Authorization: Bearer $1" \ | ||
-H "X-Commit-Revision: $REVISION" \ | ||
-H "X-Commit-Branch: $BRANCH" \ | ||
-H "X-Commit-Author: $AUTHOR" \ | ||
-H "X-Commit-Message: $MESSAGE" \ | ||
-H "X-Commit-Date: $DATE" \ | ||
$FILES $URL \ | ||
&& echo Upload successful \ | ||
|| echo Upload failed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters