-
-
Save dreamcat4/fd3bb6f116a05f6acdaa to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
# | |
# You should define BINTRAY_ACCOUNT and BINTRAY_APIKEY here or from the outside | |
# BINTRAY_ACCOUNT is you Bintray account and BINTRAY_APIKEY, API Key generated under your Bintray profile | |
# Redefine following variables to match your own usage | |
RPMS_DIR=RPMS/noarch | |
BINTRAY_ACCOUNT=hgomez | |
BINTRAY_REPO=devops-incubator-rpm | |
BASE_DESC=https://github.com/hgomez/devops-incubator/tree/master/rpm-packaging | |
for RPM_FILE in $RPMS_DIR/*.rpm; do | |
RPM_NAME=`rpm --queryformat "%{NAME}" -qp $RPM_FILE` | |
RPM_VERSION=`rpm --queryformat "%{VERSION}" -qp $RPM_FILE` | |
RPM_RELEASE=`rpm --queryformat "%{RELEASE}" -qp $RPM_FILE` | |
RPM_ARCH=`rpm --queryformat "%{ARCH}" -qp $RPM_FILE` | |
echo "RPM_NAME=$RPM_NAME, RPM_VERSION=$RPM_VERSION, RPM_RELEASE=$RPM_RELEASE, RPM_ARCH=$RPM_ARCH" | |
echo "@@@@@@@@@@@@@@@@@@@@@@" | |
echo "@@@ create package @@@" | |
echo "@@@@@@@@@@@@@@@@@@@@@@" | |
curl -vvf -u$BINTRAY_USER:$BINTRAY_APIKEY -H "Content-Type: application/json" -X POST https://api.bintray.com/packages/$BINTRAY_ACCOUNT/$BINTRAY_REPO/ --data "{ \"name\": \"$RPM_NAME\", \"desc\": \"auto\", \"desc_url\": \"$BASE_DESC/$RPM_NAME\", \"labels\": \"\" }" | |
echo "@@@@@@@@@@@@@@@@@@@@@@" | |
echo "@@@ delete version @@@" | |
echo "@@@@@@@@@@@@@@@@@@@@@@" | |
curl -vvf -u$BINTRAY_USER:$BINTRAY_APIKEY -X DELETE https://api.bintray.com/packages/$BINTRAY_ACCOUNT/$BINTRAY_REPO/$RPM_NAME/versions/$RPM_VERSION-$RPM_RELEASE | |
echo "@@@@@@@@@@@@@@@@@@@@@@" | |
echo "@@@ create version @@@" | |
echo "@@@@@@@@@@@@@@@@@@@@@@" | |
curl -vvf -u$BINTRAY_USER:$BINTRAY_APIKEY -H "Content-Type: application/json" -X POST https://api.bintray.com/packages/$BINTRAY_ACCOUNT/$BINTRAY_REPO/$RPM_NAME/versions --data "{ \"name\": \"$RPM_VERSION-$RPM_RELEASE\", \"release_notes\": \"auto\", \"release_url\": \"$BASE_DESC/$RPM_NAME\", \"released\": \"\" }" | |
echo "@@@@@@@@@@@@@@@@@@@@@@" | |
echo "@@@ upload content @@@" | |
echo "@@@@@@@@@@@@@@@@@@@@@@" | |
# curl -vvf -T $RPM_FILE -u$BINTRAY_USER:$BINTRAY_APIKEY -H "X-Bintray-Package:$RPM_NAME" -H "X-Bintray-Version:$RPM_VERSION-$RPM_RELEASE" https://api.bintray.com/content/$BINTRAY_ACCOUNT/$BINTRAY_REPO/$RPM_NAME-$RPM_VERSION-$RPM_RELEASE.$RPM_ARCH.rpm | |
curl -vvf -T $RPM_FILE -u$BINTRAY_USER:$BINTRAY_APIKEY -H "X-Bintray-Package:$RPM_NAME" -H "X-Bintray-Version:$RPM_VERSION-$RPM_RELEASE" https://api.bintray.com/content/$BINTRAY_ACCOUNT/$BINTRAY_REPO/ | |
echo "@@@@@@@@@@@@@@@@@@@@@@@" | |
echo "@@@ publish content @@@" | |
echo "@@@@@@@@@@@@@@@@@@@@@@@" | |
curl -vvf -u$BINTRAY_USER:$BINTRAY_APIKEY -H "Content-Type: application/json" -X POST https://api.bintray.com/content/$BINTRAY_ACCOUNT/$BINTRAY_REPO/$RPM_NAME/$RPM_VERSION-$RPM_RELEASE/publish --data "{ \"discard\": \"false\" }" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment