-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from leopardslab/deb-package
Deb package
- Loading branch information
Showing
6 changed files
with
271 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ coverage* | |
.idea/* | ||
|
||
snap.login | ||
|
||
.DS_Store |
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,109 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
REPO="dunner-deb" | ||
PACKAGE="dunner" | ||
DISTRIBUTIONS="stable" | ||
COMPONENTS="main" | ||
|
||
if [ -z "$USER" ]; then | ||
echo "USER is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$API_KEY" ]; then | ||
echo "API_KEY is not set" | ||
exit 1 | ||
fi | ||
|
||
setVersion () { | ||
VERSION=$(curl --silent "https://api.github.com/repos/leopardslab/dunner/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'); | ||
} | ||
|
||
setUploadDirPath () { | ||
UPLOADDIRPATH="pool/d/$PACKAGE" | ||
} | ||
|
||
downloadDebianArtifacts() { | ||
echo "Dowloading debian artifacts" | ||
FILES=$(curl -s https://api.github.com/repos/leopardslab/dunner/releases/latest \ | ||
| grep "browser_download_url.*deb" \ | ||
| cut -d : -f 3 \ | ||
| sed -e 's/^/https:/' \ | ||
| tr -d '"' ); | ||
echo $FILES | ||
for i in $FILES; do | ||
RESPONSE_CODE=$(curl -O -w "%{response_code}" "$i") | ||
code=$(echo "$RESPONSE_CODE" | head -c2) | ||
if [ $code != "20" ] && [ $code != "30" ]; then | ||
echo "Unable to download $i HTTP response code: $RESPONSE_CODE" | ||
fi | ||
done; | ||
echo "Finished downloading" | ||
} | ||
|
||
bintrayUpload () { | ||
for i in $FILES; do | ||
FILENAME=${i##*/} | ||
ARCH=$(echo ${FILENAME##*_} | cut -d '.' -f 1) | ||
if [ $ARCH == "386" ]; then | ||
ARCH="i386" | ||
fi | ||
|
||
URL="https://api.bintray.com/content/leopardslab/$REPO/$PACKAGE/$VERSION/$UPLOADDIRPATH/$FILENAME;deb_distribution=$DISTRIBUTIONS;deb_component=$COMPONENTS;deb_architecture=$ARCH?publish=1&override=1" | ||
echo "Uploading $URL" | ||
|
||
RESPONSE_CODE=$(curl -T $FILENAME -u$USER:$API_KEY $URL -I -s -w "%{response_code}" -o /dev/null); | ||
code=$(echo "$RESPONSE_CODE" | head -c2) | ||
if [ $code != "20" ] && [ $code != "30" ]; then | ||
echo "Unable to upload, HTTP response code: $RESPONSE_CODE" | ||
exit 1 | ||
fi | ||
echo "HTTP response code: $RESPONSE_CODE" | ||
done; | ||
} | ||
|
||
bintraySetDownloads () { | ||
for i in $FILES; do | ||
FILENAME=${i##*/} | ||
ARCH=$(echo ${FILENAME##*_} | cut -d '.' -f 1) | ||
if [ $ARCH == "386" ]; then | ||
ARCH="i386" | ||
fi | ||
URL="https://api.bintray.com/file_metadata/leopardslab/$REPO/$UPLOADDIRPATH/$FILENAME" | ||
|
||
echo "Putting $FILENAME in $PACKAGE's download list" | ||
RESPONSE_CODE=$(curl -X PUT -d "{ \"list_in_downloads\": true }" -H "Content-Type: application/json" -u$USER:$API_KEY $URL -s -w "%{http_code}" -o /dev/null); | ||
|
||
if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then | ||
echo "Unable to put in download list, HTTP response code: $RESPONSE_CODE" | ||
exit 1 | ||
fi | ||
echo "HTTP response code: $RESPONSE_CODE" | ||
done | ||
} | ||
|
||
snooze () { | ||
echo "\nSleeping for 30 seconds. Have a coffee..." | ||
sleep 30s; | ||
echo "Done sleeping\n" | ||
} | ||
|
||
printMeta () { | ||
echo "Publishing: $PACKAGE" | ||
echo "Version to be uploaded: $VERSION" | ||
} | ||
|
||
cleanArtifacts () { | ||
rm -f "$(pwd)/*.deb" | ||
} | ||
|
||
cleanArtifacts | ||
downloadDebianArtifacts | ||
setVersion | ||
printMeta | ||
setUploadDirPath | ||
bintrayUpload | ||
snooze | ||
bintraySetDownloads |
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,109 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
REPO="dunner-rpm" | ||
PACKAGE="dunner" | ||
|
||
if [ -z "$USER" ]; then | ||
echo "USER is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$API_KEY" ]; then | ||
echo "API_KEY is not set" | ||
exit 1 | ||
fi | ||
|
||
setVersion () { | ||
VERSION=$(curl --silent "https://api.github.com/repos/leopardslab/dunner/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'); | ||
} | ||
|
||
setUploadDirPath () { | ||
UPLOADDIRPATH="$PACKAGE/$VERSION" | ||
} | ||
|
||
downloadRpmArtifacts() { | ||
echo "Dowloading rpm artifacts" | ||
FILES=$(curl -s https://api.github.com/repos/leopardslab/dunner/releases/latest \ | ||
| grep "browser_download_url.*rpm" \ | ||
| cut -d : -f 3 \ | ||
| sed -e 's/^/https:/' \ | ||
| tr -d '"' ); | ||
echo "$FILES" | ||
for i in $FILES; do | ||
RESPONSE_CODE=$(curl -O -w "%{response_code}" "$i") | ||
echo "$RESPONSE_CODE" | ||
code=$(echo "$RESPONSE_CODE" | head -c2) | ||
if [ $code != "20" ] && [ $code != "30" ]; then | ||
echo "Unable to download $i HTTP response code: $RESPONSE_CODE" | ||
exit 1 | ||
fi | ||
done; | ||
echo "Finished downloading" | ||
} | ||
|
||
bintrayUpload () { | ||
for i in $FILES; do | ||
FILENAME=${i##*/} | ||
ARCH=$(echo ${FILENAME##*_} | cut -d '.' -f 1) | ||
if [ $ARCH == "386" ]; then | ||
ARCH="i386" | ||
fi | ||
|
||
URL="https://api.bintray.com/content/leopardslab/$REPO/$PACKAGE/$VERSION/$UPLOADDIRPATH/$FILENAME?publish=1&override=1" | ||
echo "Uploading $URL" | ||
|
||
RESPONSE_CODE=$(curl -T $FILENAME -u$USER:$API_KEY $URL -I -s -w "%{http_code}" -o /dev/null); | ||
if [[ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]]; then | ||
echo "Unable to upload, HTTP response code: $RESPONSE_CODE" | ||
exit 1 | ||
fi | ||
echo "HTTP response code: $RESPONSE_CODE" | ||
done; | ||
} | ||
|
||
bintraySetDownloads () { | ||
for i in $FILES; do | ||
FILENAME=${i##*/} | ||
ARCH=$(echo ${FILENAME##*_} | cut -d '.' -f 1) | ||
if [ $ARCH == "386" ]; then | ||
ARCH="i386" | ||
fi | ||
URL="https://api.bintray.com/file_metadata/leopardslab/$REPO/$UPLOADDIRPATH/$FILENAME" | ||
|
||
echo "Putting $FILENAME in $PACKAGE's download list" | ||
RESPONSE_CODE=$(curl -X PUT -d "{ \"list_in_downloads\": true }" -H "Content-Type: application/json" -u$USER:$API_KEY $URL -s -w "%{http_code}" -o /dev/null); | ||
|
||
if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then | ||
echo "Unable to put in download list, HTTP response code: $RESPONSE_CODE" | ||
exit 1 | ||
fi | ||
echo "HTTP response code: $RESPONSE_CODE" | ||
done | ||
} | ||
|
||
snooze () { | ||
echo "\nSleeping for 30 seconds. Have a coffee..." | ||
sleep 30s; | ||
echo "Done sleeping\n" | ||
} | ||
|
||
printMeta () { | ||
echo "Publishing: $PACKAGE" | ||
echo "Version to be uploaded: $VERSION" | ||
} | ||
|
||
cleanArtifacts () { | ||
rm -f "$(pwd)/*.rpm" | ||
} | ||
|
||
cleanArtifacts | ||
downloadRpmArtifacts | ||
setVersion | ||
printMeta | ||
setUploadDirPath | ||
bintrayUpload | ||
snooze | ||
bintraySetDownloads | ||
|
This file was deleted.
Oops, something went wrong.