From 0c43b069a2bd91e1886fd33e6a386366a3c39d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Cass=C3=A9?= Date: Mon, 18 Apr 2016 23:09:20 +0200 Subject: [PATCH] Add script to auto upload binay files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vincent Cassé --- scripts/release_binary.sh | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 scripts/release_binary.sh diff --git a/scripts/release_binary.sh b/scripts/release_binary.sh new file mode 100755 index 0000000..e96e8f1 --- /dev/null +++ b/scripts/release_binary.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +VERSION="$1" +USER="$2" +TOKEN="$3" + +cd /tmp +mkdir php-ovh-bin +cd php-ovh-bin + +php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php +php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === '7228c001f88bee97506740ef0888240bd8a760b046ee16db8f4095c0d8d525f2367663f22a46b48d072c816e7fe19959') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" +php composer-setup.php +php -r "unlink('composer-setup.php');" + +echo '{ + "name": "Example Application", + "description": "This is an example of OVH APIs wrapper usage", + "require": { + "ovh/ovh": "2.x" + } +}' > composer.json + +php composer.phar install + +echo 'get("/me"); + print_r( $me ); + +} catch ( Exception $ex ) { + print_r( $ex->getMessage() ); +}' > script.php + +zip -r php-ovh-$VERSION-with-dependencies.zip . + +ID=$(curl https://api.github.com/repos/ovh/php-ovh/releases/tags/v$VERSION -u $USER:$TOKEN | jq -r '.id') + +curl -X POST -d @php-ovh-$VERSION-with-dependencies.zip -H "Content-Type: application/zip" https://uploads.github.com/repos/ovh/php-ovh/releases/$ID/assets?name=php-ovh-$VERSION-with-dependencies.zip -i -u $USER:$TOKEN +rm php-ovh-$VERSION-with-dependencies.zip + +tar -czf php-ovh-$VERSION-with-dependencies.tar.gz . +curl -X POST -d @php-ovh-$VERSION-with-dependencies.tar.gz -H "Content-Type: application/zip" https://uploads.github.com/repos/ovh/php-ovh/releases/$ID/assets?name=php-ovh-$VERSION-with-dependencies.tar.gz -i -u $USER:$TOKEN