diff --git a/docs/PUBLISHING.md b/docs/PUBLISHING.md index 3f8eaf80..9ddbb628 100644 --- a/docs/PUBLISHING.md +++ b/docs/PUBLISHING.md @@ -55,8 +55,24 @@ Run the following command: > .\scripts\build\windows.bat all ``` -Publishing ----------- +Publishing to Bintray +--------------------- + +We publish GNU/Linux Debian packages to [Bintray][bintray]. + +Make sure you set the following environment variables: + +- `BINTRAY_USER` +- `BINTRAY_API_KEY` + +Run the following command: + +```sh +./scripts/publish/bintray-debian.sh +``` + +Publishing to S3 +---------------- - [AWS CLI][aws-cli] @@ -69,7 +85,7 @@ access Resin.io's production downloads S3 bucket. Run the following command: ```sh -./scripts/publish.sh +./scripts/publish/aws-s3.sh ``` Announcing @@ -80,3 +96,4 @@ new version of Etcher, and including the relevant section of the Changelog. [aws-cli]: https://aws.amazon.com/cli [cygwin]: https://cygwin.com +[bintray]: https://bintray.com diff --git a/scripts/publish.sh b/scripts/publish/aws-s3.sh similarity index 100% rename from scripts/publish.sh rename to scripts/publish/aws-s3.sh diff --git a/scripts/publish/bintray-debian.sh b/scripts/publish/bintray-debian.sh new file mode 100755 index 00000000..4374da8c --- /dev/null +++ b/scripts/publish/bintray-debian.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -e + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " 1>&2 + exit 1 +fi + +if [ -z $BINTRAY_USER ] || [ -z $BINTRAY_API_KEY ]; then + echo "Please define the following environment variables:" 1>&2 + echo "" 1>&2 + echo " BINTRAY_USER" 1>&2 + echo " BINTRAY_API_KEY" 1>&2 + exit 1 +fi + +ARGV_FILE=$1 +PACKAGE_COMPONENT=etcher +PACKAGE_DISTRIBUTION=stable +PACKAGE_FILE_NAME=$(basename $ARGV_FILE) +PACKAGE_NAME=${PACKAGE_FILE_NAME%.*} +PACKAGE_VERSION=$(echo $PACKAGE_NAME | cut -d_ -f2 | tr "~" "-") +PACKAGE_ARCH=$(echo $PACKAGE_NAME | cut -d_ -f3) + +if [ -z $PACKAGE_VERSION ]; then + echo "Couldn't infer the version from the package file name" 1>&2 + exit 1 +fi + +if [ -z $PACKAGE_ARCH ]; then + echo "Couldn't infer the architecture from the package file name" 1>&2 + exit 1 +fi + +curl --upload-file $ARGV_FILE \ + --user $BINTRAY_USER:$BINTRAY_API_KEY \ + --header "X-Bintray-Debian-Distribution: $PACKAGE_DISTRIBUTION" \ + --header "X-Bintray-Debian-Component: $PACKAGE_COMPONENT" \ + --header "X-Bintray-Debian-Architecture: $PACKAGE_ARCH" \ + --header "X-Bintray-Publish: 1" \ + https://api.bintray.com/content/resin-io/debian/$PACKAGE_COMPONENT/$PACKAGE_VERSION/$PACKAGE_FILE_NAME + +echo "$ARGV_FILE has been uploaded successfully"